Closed patel999jay closed 3 years ago
I'd avoid using Bokeh functions directly on the plot, as the arlpy.plot
internal state is not updated when you show()
a plot held by arlpy. The right way to show the held plot would be using plt.hold(False)
, as shown below:
import arlpy.uwapm as pm
import arlpy.plot as plt
import numpy as np
env = pm.create_env2d()
surface = np.array([[r, 0.5+0.5*np.sin(2*np.pi*0.005*r)] for r in np.linspace(0,1000,1001)])
env['surface'] = surface
plt.figure(title='Demo 1', width=500)
plt.plot([0,10], [0,10],thickness=5, hold=True)
p = plt.gcf()
p.axis.major_tick_line_width = 10
p.xaxis.major_label_text_font_size = "25pt"
p.yaxis.major_label_text_font_size = "25pt"
plt.hold(False)
The problem why your second code example doesn't work is that the hold
option isn't supported by the plot_env()
function. You can hold the plot first and then use plot_env()
in the held plot. The following code does what you want:
plt.figure(title='Underwater Enviornment', width=900)
plt.hold(True)
pm.plot_env(env,surface_color='blue', thickness=10)
p = plt.gcf()
p.axis.major_tick_line_width = 10
p.xaxis.major_label_text_font_size = "25pt"
p.yaxis.major_label_text_font_size = "25pt"
plt.hold(False)
could we have control on the font size of the axis labels (x, y, color) and tick labels for 2D images plotted by plot_env by passing them as parameters ?
This seems weird to me as below method works fine with the plot but I think
plot_env
is the custom function but does that mean it didn't hold all the child property if you doplt.gcf()
? Please refer the below example for more details. May be it is something to do withbokeh
.This won't let you set the
major_tick_line_width
and throw and an error