Jay Patel
Jay Patel

Reputation: 1420

How can i change existing Bokeh plot tick sizes?

How can i change the existing Bokeh plot ticks size, specifically package that was being used to plot already defined a plot layout of bokeh ? How can i overwrite those layout ? Below is the example code of the plot to reproduce the plot.

# !pip install arlpy
import arlpy.uwapm as pm
import arlpy.plot as plt
env = pm.create_env2d()
pm.plot_env(env, width=900)

Here is the generated figure for which i want to redefined layout. enter image description here

Upvotes: 0

Views: 60

Answers (1)

mosc9575
mosc9575

Reputation: 6337

This is a bit tricky and but it is possible to get it done. But I have to mention that I don't like this solution.

To get a figure you have to enable the hold argument because otherwise it will be plotted immediately and return None. Then you can get the current figure using arlpy.plot.gcf() and set all parameters. To show the figure now you have to use the bokeh call show because the figure is a bokeh object now and in arlpy it is not available to set the hold to False again and show the figure. In fact the figure is now waiting for some data to add.

Here is an example.

from bokeh.plotting import figure, show
import arlpy.plot
arlpy.plot.figure(title='Demo 1', width=500)

arlpy.plot.plot([0,10], [0,10], hold=True)
p = arlpy.plot.gcf()
p.axis.major_tick_line_width = 3
show(p)

Unfortunately I found no solution where I use import arlpy.uwapm as pm because there is no return parameter in the plot_envfunction. So you can`t get the figure and make some changes.

I hope this helps. But I guess it is not satisfying.

Upvotes: 3

Related Questions