8000 Plotting with subsets (row-wise) of ColumnDataSources (like filtered data) · Issue #4070 · bokeh/bokeh · GitHub
[go: up one dir, main page]

Skip to content

Plotting with subsets (row-wise) of ColumnDataSources (like filtered data) #4070

@clairetang6

Description

@clairetang6

Currently, Bokeh only allows glyphs to take full columns of data from a ColumnDataSource. This means that you must have additional ColumnDataSources for any plots that only use a subset of the data. This causes data to be replicated and makes linked selection more complicated for users, who would have to keep track of indices themselves.

It would be nice if Bokeh allowed glyphs to take subsets of columns as data. An application using multiple plots, each showing some subset (e.g. filtered by the value of some column, like the example @dennisobrien showed at the SF meetup) of the data (or the full set), would then be able to completely share the data in the same way that Bokeh allows plots to share the full ColumnDataSource now. Linked selection would work intuitively with selected data points (rows) showing up in whichever plots contain that point. Holding shift before selecting on any plot would add to the selection.

One possibility for an API would be to include another parameter that picks the subset of data for a renderer to use by the indices (which could default to all).

data_source = ColumnDataSource(df)
fig = figure()
r = fig.circle(x =x’, y =y’, source=data_source, indices=[0, 1, 2]) 
r = fig.circle(x =x’, y =y’, source=data_source, indices=np.arange(n)[df.weather ==sunny”])
r = fig.circle(x =x’, y =y’, source=data_source, indices=[i for i, val in enumerate(df.weather) if val ==sunny”])

Another possibility could be to make the data source “filterable” in a pandas-like way.

r = fig.circle(x =x’, y =y’, source=data_source[ data_source.weather ==sunny” ]) 

I tried to look through the issues and google group to find some related posts.
#2323
#2710
https://groups.google.com/a/continuum.io/forum/#!searchin/bokeh/data$20source%7Csort:date/bokeh/_DIOQGlC6ds/EbZL0KRfBwAJ
https://groups.google.com/a/continuum.io/forum/#!searchin/bokeh/data$20source%7Csort:date/bokeh/79eSMaDV39I/OTfZqZHIug0J

Is this something that would be in Bokeh’s scope?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0