Different color bars with ColumnDataSource

Hello,

I found this example where filtering on a pandas data frame is used to split data in two and then plot each with a different color vbar.

I want to do something similar, but I am using ColumnDataSource as my data source and, as far as I know, you can’t filter row-wise. Is there a good solution for this that doesn’t require passing my data from ColumnDataSource to a dataframe and back again?

Hi,

Filterable CDS is an open issue. There is an open PR for it:

  https://github.com/bokeh/bokeh/pull/5982

As the CDS is a central data structure to Bokeh, and as there are many possible interactions, the PR is in need of more testing and development to ensure the semantics make sense in all cases. It should be ready and merged for the next 0.12.6 release, however.

However, you may not need that. If you just want to shade different vbars different colors based on some field, you can pass a color mapper as a transform for the fill_color, as show in this example:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/texas.py#L42

That example uses a continuous color mapper but a categorical one would work fine as well, and that would "split" the data, at least visually.

Thanks,

Bryan

···

On Apr 8, 2017, at 16:21, Laura Suttle <[email protected]> wrote:

Hello,

I found this example where filtering on a pandas data frame is used to split data in two and then plot each with a different color vbar.

http://bokeh.pydata.org/en/latest/docs/gallery/candlestick.html

I want to do something similar, but I am using ColumnDataSource as my data source and, as far as I know, you can't filter row-wise. Is there a good solution for this that doesn't require passing my data from ColumnDataSource to a dataframe and back again?

--
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/de288823-ebed-4d94-9874-d80d92d62db0%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.