Hi Yanick and Bryan,
could either of you please post a working example? I am trying to do the same thing without success. Specifically, what I am trying to do is to drive a data selection by operating a slider that controls a y-axis value (indicated in the plot by an horizontal line). The selection should comprise all data values below/above that y value. I would like to implement the data selection within the Slider.on_change Python callback.
Conceptually, here is what I have (I am running this with >>bokeh serve …):
Data source and plot
source = ColumnDataSource(…)
figure(…).circle(‘x’, ‘y’, source = source, …)
def slider_selection(attrname, old, new):
# Should update source.selected and
# trigger the plot update correspondingly
Slider and its callback
max_slider = Slider(start=min(y), end=max(y), value=max(y), step=0.1, title=“Maximum”)
Thanks a lot for any hints!
On Thursday, 2 June 2016 22:20:27 UTC+2, Yanick MacAngus wrote:
That worked thanks!
On Thursday, June 2, 2016 at 4:26:39 PM UTC-3, Bryan Van de ven wrote:
We probably need to make .selected a proper Bokeh model. For now, there is no way to detect changes “inside” the .selected dict. So, short term solution: copy .selected, update the copy, and then reassign entire copy as value of .selected at once. The automagic machinery can detect when .selected changes as a whole.
On Jun 2, 2016, at 2:08 PM, Yanick MacAngus [email protected] wrote:
I have a scatter plot that gets its data from a ColumnDataSource. Is there a way to change the selected points with my python program, rather than with a selection tool? I can edit the selected indices of the ColumnDataSource like this:
source.selected[“1d”][“indices”] = selected_dict
But that doesn’t change the points on the plot.
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3c18d736-90dc-4c5a-bcb5-2703c0558787%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.