Bar chart with data from columndatasource

LS
Can a columndatasource be used to make a bar chart ?

I can’t find an example

Thnx

Hi Arthur,

We are about to release version 0.10 which updates the charts API in a way that has been requested for a long time, namely to make it more "pandas dataframe" oriented. So with the new API, you can do,

  from bokeh.charts import Bar, output_file, show
  from bokeh.sampledata.autompg import autompg as df

  p = Bar(df, 'cyl', values='mpg', title="Total MPG by CYL")

  output_file("bar.html")
  show(p)

You can actually see much better new charts docs here:

  http://bokeh.pydata.org/en/dev/docs/user_guide/charts.html

(These are the "dev" docs they will be deployed to the main docs URL after the release)

This doesn't quite answer your question, since you asked about ColumnDataSources. We should probably make Charts understand these as natively as we can, as well, but in the mean time, you can use the "to_df()" method of ColumnDataSource, something like:

  df = my_data_source.to_ds()
  p = Bar(df, 'foo', values='bar')

Hope that helps.

Bryan

···

On Sep 23, 2015, at 2:00 PM, Arthur Dijkstra <[email protected]> wrote:

LS
Can a columndatasource be used to make a bar chart ?
I can't find an example
Thnx

--
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/3ee1d45e-c9cd-4ea9-93bb-ed0bf1e90fef%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks