You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to clear drawn lines from streamed data via source.stream(data, rollover=1) the clear doesn't work if the line's x and y are numpy arrays in the associated ColumnDataSource. Instead a new line is drawn using the last of the old data and the new data.
This is different to the behaviour if either x or y is a list.
Minimal Example
Tested under Windows 10 + Mozilla Firefox in Jupyter Lab with the following packages
from bokeh.io import output_notebook, show, push_notebook
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
import numpy as np
output_notebook()
notebook_url="http://localhost:8888"
p = figure(match_aspect=True)
source1 = ColumnDataSource(data={"x": [-1, 0], "y1": [-1, -1] })
p.line(x='x', y='y1', source=source1, line_width=6, legend_label="List Source", line_color="blue")
source2 = ColumnDataSource(data={"x": np.array([0, 1]), "y1": np.array([0, 0]) })
p.line(x='x', y='y1', source=source2, line_width=6, legend_label="Array Source", line_color="red")
source3 = ColumnDataSource(data={"x": np.array([1, 2]), "y1": [1, 1] })
p.line(x='x', y='y1', source=source3, line_width=6, legend_label="Array X, List Y", line_color="yellow")
source4 = ColumnDataSource(data={"x": [2, 3], "y1": np.array([2, 2]) })
p.line(x='x', y='y1', source=source4, line_width=6, legend_label="List X, Array Y", line_color="orange")
plot_handle = show(p, notebook_url=notebook_url, notebook_handle=True)
### Attempt to clear data
# Update list only source
source1.stream({"x": [4], "y1": [4]}, rollover=1)
# Update array only source
source2.stream({"x": np.array([4]), "y1": np.array([4])}, rollover=1)
# Update array x, list y source
source3.stream({"x": np.array([4]), "y1": [4]}, rollover=1)
# Update array x, list y source
source4.stream({"x": [4], "y1": np.array([4])}, rollover=1)
push_notebook(handle=plot_handle)
This raises a Javascript console warning: [bokeh] data source has columns of inconsistent lengths caused by the sources with mixed data types. Same behaviour exists when these are removed.
The text was updated successfully, but these errors were encountered:
Issue
When attempting to clear drawn lines from streamed data via
source.stream(data, rollover=1)
the clear doesn't work if the line'sx
andy
are numpy arrays in the associatedColumnDataSource
. Instead a new line is drawn using the last of the old data and the new data.This is different to the behaviour if either
x
ory
is a list.Minimal Example
Tested under Windows 10 + Mozilla Firefox in Jupyter Lab with the following packages
Actual Example:
This raises a Javascript console warning:
[bokeh] data source has columns of inconsistent lengths
caused by the sources with mixed data types. Same behaviour exists when these are removed.The text was updated successfully, but these errors were encountered: