So, I have the following task:
I have a set of points (pretty large), that I want to plot as a scatterplot. Since the set is large, to make sense of it, I would like to zoom in on a particular point via its index.
I create a TextInput widget, where the index will be input, and during a callback I want to find the corresponding element and set the figure properties
around this point.
However, I don’t seem to have a good way of doing that, since my attempts are either not doing anything, or completely freezing the browser window…
Here’s my sample code that doesn’t respond to text field changes:
source = ColumnDataSource(
ids = list(range(10)),
p = figure(plot_width=800, plot_height=800, tools=[‘pan’,‘box_zoom’,‘wheel_zoom’,‘reset’],toolbar_location=‘below’,
tsneplot.background_fill_color = “grey”
tsneplot.background_fill_alpha = 0.35
p.circle(‘x’,‘y’, size=10, color=‘navy’,source=source)
text_input = TextInput(value=“4”, title=“Enter ID:”)
data = source.data
x, y, ids = data[‘x’], data[‘y’], data[‘ids’]
cInd = ids.index(cb_obj.value)
center = [x[cInd],y[cInd]]
p.x_range = Range1d(center-.1,center+.1)
p.y_range = Range1d(center-.1,center+.1)
P.S: the toolbar_location seems to be overwritten by gridplot?