Behavior of CDSView used with Line glyphs needs to be documented
See original GitHub issueOriginally posted on the mailing list (https://groups.google.com/a/continuum.io/forum/#!msg/bokeh/GR_qCar2-nA/P6ZLnvA0AQAJ) where it was suggested that I wait for the next dev build, and if this was not resolved to report it as a bug here. I’m a little late, but the issue still exists as of yesterday’s 0.12.10 release.
I’m working in Anaconda 5/Python 3.6.2 on a Windows 10 system with Bokeh 0.12.10, looking at things in Firefox 55.0.3, 64-bit everything.
Example code for a thing that produces the expected line from points (1,1) to (3,3):
from bokeh import plotting,models
data = {'x_vals':[1,2,3,4],
'y_vals':[1,2,3,4],
'group':['a','b','a','c']}
data_source = models.ColumnDataSource(data=data)
current_view = models.CDSView(source=data_source, filters=[models.
IndexFilter([2,0])])
plotting.output_file("test.html")
plot = plotting.figure(plot_width=400, plot_height=400)
plot.line(x='x_vals',y='y_vals',source=data_source,view=current_view)
plotting.show(plot)
If I change the order of the list I’m feeding to IndexFilter it instead produces a plot with no line:
from bokeh import plotting,models
data = {'x_vals':[1,2,3,4],
'y_vals':[1,2,3,4],
'group':['a','b','a','c']}
data_source = models.ColumnDataSource(data=data)
current_view = models.CDSView(source=data_source, filters=[models.
IndexFilter([0,2])])
plotting.output_file("test.html")
plot = plotting.figure(plot_width=400, plot_height=400)
plot.line(x='x_vals',y='y_vals',source=data_source,view=current_view)
plotting.show(plot)
Attempting to use GroupFilter to select points (1,1) and (3,3) also produces an empty plot:
from bokeh import plotting,models
data = {'x_vals':[1,2,3,4],
'y_vals':[1,2,3,4],
'group':['a','b','a','c']}
data_source = models.ColumnDataSource(data=data)
current_view = models.CDSView(source=data_source, filters=[models.
GroupFilter(column_name='group',group='a')])
plotting.output_file("test.html")
plot = plotting.figure(plot_width=400, plot_height=400)
plot.line(x='x_vals',y='y_vals',source=data_source,view=current_view)
plotting.show(plot)
I would expect all three bits of code to produce identical plots, with a line from (1,1) to (3,3).
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
Bumping this because I don’t see why we cannot have it both ways and it seems intuitive to have the filtered data all connect lines between them. In my case I’m plotting each filtered view on a different figure in a grid so all the disconnections look silly. I don’t see why I would want to use multiple data sources for these plots when I could just update the one datasource and have it cascade to all plots when needed.
So I have a similar problem to kkuntze1, but I would really need the first policy described by @clairetang6 to work.
Since I do need line-chart, and I would like to only have one datascource with all data, continously updating with datapoints from a streaming source. And display sub-plots for different filters. Using CDS-views. Right now I can only get this to work with scatter plots.
Is the preferred way of doing that to have multiple datasources as it is implemented right now, or is there a way of solving this with CDSview and line-plots?