Hello guys,
from datas coming to various directories, I want to plot and save them into their directories respectively.
I show many answers that explain to use reset_plot() after/before the function save or output_file.
https://discourse.bokeh.org/t/programmatically-creating-plots-in-a-loop/4056/6
https://stackoverflow.com/questions/37290219/bokeh-generating-graphs-in-a-loop-the-output-graphs-file-sizes-keep-increasin
Following the instructions above, they do not work for me.
I show you the minimal version of my problem below.
Let’s remind that i use the following version of python 3.6 and bokeh 2.2.0.
Thanks for your help.
def plot_data(data):
output_file("dashboard_evolution_probs_mode_{}.html".format(
''.join(data.keys())))
p = figure(plot_height = int(HEIGHT*1.0),
plot_width = int(WIDTH*1.5),
title = "test",
x_axis_label = "abs",
y_axis_label = "ord",
x_axis_type = "linear",
tools = TOOLS)
source = ColumnDataSource(data)
cpt = 0
for key, value in data.items():
p.circle(x="x", y=key, source=source, size=2,
color="red", legend_label=key)
p.line(x="x", y=key, source=source,line_color=Viridis256[cpt])
cpt += 1
save(p)
reset_output()
return p
def light_version_of_problem():
data_xyz = {"x": np.random.uniform(low=0.5, high=13.3, size=(10,)),
"y": np.random.uniform(low=0.5, high=5.3, size=(10,)),
"z": np.random.uniform(low=0.5, high=10.3, size=(10,))
}
data_uvt = {"x": np.random.uniform(low=0.5, high=13.3, size=(10,)),
"v": np.random.uniform(low=0.5, high=5.3, size=(10,)),
"t": np.random.uniform(low=0.5, high=10.3, size=(10,))
}
for data in [data_xyz, data_uvt] :
plot_data(data)
reset_output()