Unexpected warning when updating a linked plot

Hi
I have taken the selection_histogram.py code and changed is a little to display not a histogram but a multi-line plot on the right panel.
the simple code is attached and can be run in the usual way

bokeh serve basic_selection_profile.py

and then open http://localhost:5006/basic_selection_profile

at first all lines are colored red (as expected). then reset (not clear why) and all lines will turn into gray. Then use a selection tool to select some points in the scatter plot. Once these are selected the corresponding line plot(s) will be shown up as red.

At the same time Warnings are popping up, indicating that some arrays which should have same length are having different lengths.

Questions: is this the expected behavious, if not is there an error in my simple code. Do i miss an important reset.

If you donot reset the plot at the beginning it will not work at all: Not clear to me why this reset is needed.

also where can i find a little more background info. Could not find easy an entry in the user guide for this type of plots

many thanks

stephen

basic_selection_profile.py (3.71 KB)

Hi,

The columns of a ColumnDataSource should be the same length at *all points in time*. But in your code, you are updating one column, then another. After you update the first column, the two columns have different lengths, and this triggers the warning. You need to update everything in .data "all at once". Here is one way:

  pv2.data_source.data = dict(xs=update_xst, ys=update_yst)

Thanks,

Bryan

ยทยทยท

On Mar 28, 2018, at 10:59, [email protected] wrote:

Hi
I have taken the selection_histogram.py code and changed is a little to display not a histogram but a multi-line plot on the right panel.
the simple code is attached and can be run in the usual way

bokeh serve basic_selection_profile.py

and then open http://localhost:5006/basic_selection_profile

at first all lines are colored red (as expected). then reset (not clear why) and all lines will turn into gray. Then use a selection tool to select some points in the scatter plot. Once these are selected the corresponding line plot(s) will be shown up as red.

At the same time Warnings are popping up, indicating that some arrays which should have same length are having different lengths.

Questions: is this the expected behavious, if not is there an error in my simple code. Do i miss an important reset.

If you donot reset the plot at the beginning it will not work at all: Not clear to me why this reset is needed.

also where can i find a little more background info. Could not find easy an entry in the user guide for this type of plots

many thanks

stephen

--
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/2ede0eba-c399-4125-989e-eca72b462964%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<basic_selection_profile.py>