Hello,
I want to use view
with line plot for reduce memory consumption.
import numpy as np
from bokeh.io import show
from bokeh.models import ColumnDataSource, CDSView, GroupFilter
from bokeh.plotting import figure
x = np.linspace(0, 10, 10)
y = 5 * x + 10
kind = ["a"] * 5 + ["b"] * 5
data = ColumnDataSource(dict(x=x, y=y, kind=kind))
view_a = CDSView(filter=GroupFilter(name="kind", group="a"))
view_b = CDSView(filter=GroupFilter(name="kind", group="b"))
The code without view
p = figure()
p.line(x="x", y="y", source=data)
show(p)
works well. But if I use view
p.line(x="x", y="y", source=data, view=view_a)
show(p)
it raises
ERROR:bokeh.core.validation.check:E-1024 (CDSVIEW_FILTERS_WITH_CONNECTED): CDSView filters are not compatible with glyphs with connected topology such as Line or Patch: GlyphRenderer(id='p1738', ...)
...
UnsetValueError: GroupFilter(id='p1687', ...).column_name doesn't have a value set
After https://github.com/bokeh/bokeh/issues/9388#issuecomment-1151378497 it looks like MultiLine
should work. But I canât understand how to use figure.multi_line
with view
â the code like
p.multi_line(xs="x", ys="y", source=data, view=view_a)
show(p)
raises UnsetValueError: GroupFilter(id='p1864', ...).column_name doesn't have a value set
even if I set x
, y
and kind
as âlist of listâ.
Moreover, it is not clear what to do if the data source will be pandas.DataFrame
(convert to dict-like with list of arrays/list/series?).