I have a plot and a dropdown menu widget. According to the choice from the menu, a different range will be configured for the y axis.
The code looks something like this:
plt = figure(plot_width=1500, plot_height=500,
tools=[‘xzoom_in’, ‘xzoom_out’, ‘xpan’, ‘reset’])
plt.y_range = Range1d(0, 1)
select_item = Select(title = ‘Select an item’,
value = data_src,
options = list(data_src))
feature_list = read_data_for_un(item)
plt.y_range.start = -0.3
plt.y_range.end = len(feature_list) - 0.8
select_item.on_change(‘value’, lambda att, old, new: update_src(new))
Draw the initial graph
By running the above code, I discover that the initial range of y axis is determined by update_src(data_src) in the above code snippet.
Now if I select an item, say data_src, the range of y axis is adjusted acoording to data set of the selected item data_src.
I zoom in the graph and press Bokeh’s default reset tool while I am still in data_src, then the range of the y axis goes back to when update_src(data_src) was selected, while my intention is to restore the range for data_src
Is there some way to override the behavior of reset tool or is there any way to make it behave as I intend?
My question seems similar to the question in the following post but I still cannot figure out how to do it: