Plot multiple lines using grouping

Suppose I have data in a pandas DataFrame and there’s a column defining grouping. What is the best way to plot lines by group using Bokeh?

Hi,

One option is to check out HoloViews, which is a very high level API for charting built on top of Bokeh:

  http://holoviews.org/

Alternatively if you want to stay in pure Bokeh, I'd suggest waiting for the next release in a few weeks. There is an open Pull request to add much improved support for categorical data, including handing easily data frame groups directly with code like this:

  group = df.groupby(('origin', 'cyl'))
  stats = group.mean()

  p = figure(x_range=FactorRange(*group.groups.keys()), y_range=(0,35))
  p.vbar(x=stats.index, top=stats.mpg, width=1, line_color="white")

This will also produce the nested categorical axes that you will expect. This fictionality should be available in a pre-release dev build sometime next week.

Thanks,

Bryan

···

On Aug 2, 2017, at 20:47, [email protected] wrote:

Suppose I have data in a pandas DataFrame and there's a column defining grouping. What is the best way to plot lines by group using Bokeh?

--
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/0ee836d9-765e-41c8-98da-b85ec6787b52%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thank you, Bryan! I’ll wait for the next release of Bokeh.

···

On Thursday, August 3, 2017 at 9:56:10 AM UTC+8, Bryan Van de ven wrote:

Hi,

One option is to check out HoloViews, which is a very high level API for charting built on top of Bokeh:

    [http://holoviews.org/](http://holoviews.org/)

Alternatively if you want to stay in pure Bokeh, I’d suggest waiting for the next release in a few weeks. There is an open Pull request to add much improved support for categorical data, including handing easily data frame groups directly with code like this:

    group = df.groupby(('origin', 'cyl'))

    stats = group.mean()



    p = figure(x_range=FactorRange(*group.groups.keys()), y_range=(0,35))

    p.vbar(x=stats.index, top=stats.mpg, width=1, line_color="white")

This will also produce the nested categorical axes that you will expect. This fictionality should be available in a pre-release dev build sometime next week.

Thanks,

Bryan

On Aug 2, 2017, at 20:47, [email protected] wrote:

Suppose I have data in a pandas DataFrame and there’s a column defining grouping. What is the best way to plot lines by group using Bokeh?


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/0ee836d9-765e-41c8-98da-b85ec6787b52%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.