I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
…but this plots 14 values on the x-axis (and I have no idea why?!)
···
On Wednesday, 27 April 2016 12:21:28 UTC+10, [email protected] wrote:
I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
…but this plots 14 values on the x-axis (and I have no idea why?!)
On Wednesday, 27 April 2016 12:21:28 UTC+10, nov…@gmail.com wrote:
I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
TIA,
Dave
–
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].
…but this plots 14 values on the x-axis (and I have no idea why?!)
On Wednesday, 27 April 2016 12:21:28 UTC+10, nov…@gmail.com wrote:
I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
TIA,
Dave
–
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].
…but this plots 14 values on the x-axis (and I have no idea why?!)
On Wednesday, 27 April 2016 12:21:28 UTC+10, nov…@gmail.com wrote:
I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
TIA,
Dave
–
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/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io?utm_medium=email&utm_source=footer) .
api may be too ingrained in me as I
can’t figure out how to use bokeh to
create a simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred to
the examples and tried multiple
things with no luck so would
greatly appreciate it if someone
please show me how to use the
bokeh api to replicate the below
plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the DataFrame
contains the x-axis labels, the
columns are the categories to
stack and the values are the
values for each label/category
TIA,
Dave
–
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 .
To post to this group, send email to .
To view this discussion on the web visit
For more options, visit [](https://groups.google.com/a/continuum.io/d/optout)[https://groups.google.com/a/](https://groups.google.com/a/)continuum.io/d/optout.
[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)
Charts prefers long data. I learned this from here:
So I re-made your dataframe into long data, from there it was pretty
straight forward:
Bar(long_df, label=‘period’, values=‘value’, stack=‘cat’,
legend=True)
Best,
Bird
matplotlib api may be too
ingrained in me as I can’t figure
out how to use bokeh to create a
simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred
to the examples and tried
multiple things with no luck so
would greatly appreciate it if
someone please show me how to
use the bokeh api to replicate
the below plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the
DataFrame contains the x-axis
labels, the columns are the
categories to stack and the
values are the values for each
label/category
TIA,
Dave
–
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
.
To post to this group, send email to .
To view this discussion on the web visit
For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)continuum.io/d/optout.
[](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)
The problem in this case is that you’d like the “new” dataframe (created from using the blend operator) to be grouped index and then stacked by the new categories column. The problem here is that the index of the original dataframe is not consistent with the new dataframe after blending. So you basically need to create a new column to create an explicit series to label to. In your case:
…but this plots 14 values on the x-axis (and I have no idea why?!)
On Wednesday, 27 April 2016 12:21:28 UTC+10, [email protected] wrote:
I think the matplotlib api may be too ingrained in me as I can’t figure out how to use bokeh to create a simple bar graph.
I’m probably just having a brain-freeze but I’ve referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
On Wednesday, 27 April 2016 12:21:28 > > > > > > UTC+10, nov...@[gmail.com](http://gmail.com) wrote:
I think the
matplotlib api may be too
ingrained in me as I can’t figure
out how to use bokeh to create a
simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred
to the examples and tried
multiple things with no luck so
would greatly appreciate it if
someone please show me how to
use the bokeh api to replicate
the below plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the
DataFrame contains the x-axis
labels, the columns are the
categories to stack and the
values are the values for each
label/category
TIA,
Dave
–
You received this message because you are
subscribed to the Google Groups “Bokeh
Discussion - Public” group.
To post to this group, send email to [email protected].
To view this discussion on the web visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io](http://continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io).
For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/optout](http://continuum.io/d/optout).
–
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
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/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
On Wednesday, 27 April 2016 12:21:28 > > > > > > > UTC+10, nov...@[gmail.com](http://gmail.com) wrote:
I think the
matplotlib api may be too
ingrained in me as I can’t figure
out how to use bokeh to create a
simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred
to the examples and tried
multiple things with no luck so
would greatly appreciate it if
someone please show me how to
use the bokeh api to replicate
the below plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the
DataFrame contains the x-axis
labels, the columns are the
categories to stack and the
values are the values for each
label/category
TIA,
Dave
–
You received this message because you are
subscribed to the Google Groups “Bokeh
Discussion - Public” group.
To post to this group, send email to [email protected].
To view this discussion on the web visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io](http://continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io).
For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/optout](http://continuum.io/d/optout).
–
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
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/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
A couple of warts:
* bokeh throws an unhelpful error message if the column labels aren't strings
* there appears no way to set the xlabel/ylabel values after the chart is created - fig.xlabel = xlabel has no effect
* bokeh insists on title-casing the column labels
-Dave
On Thursday, 28 April 2016 03:26:36 UTC+10, Sarah Bird wrote:
Hi,
...but this plots 14 values on the x-axis (and I have no idea why?!)
On Wednesday, 27 April 2016 12:21:28 UTC+10, nov...@gmail.com wrote:
I think the matplotlib api may be too ingrained in me as I can't figure out how to use bokeh to create a simple bar graph.
I'm probably just having a brain-freeze but I've referred to the examples and tried multiple things with no luck so would greatly appreciate it if someone please show me how to use the bokeh api to replicate the below plot?
On the plus side it will probably be a useful example for others used to the pandas/matplotlib api.
i.e. the index of the DataFrame contains the x-axis labels, the columns are the categories to stack and the values are the values for each label/category
Sorry for dropping off the radar. I’m in the middle of a pretty intensive home renovation, but hope to apply some time here in a month or two.
I’d recommend addressing the problem up front with the pivoted data (see: Legacy Communities - IBM TechXchange Community), but it would be good to support the pandas-like plotting interface. I really recommend reading on why this data format is recommended. After working when many types of data stores and graphics libraries, I’ve found this format eventually will start to click, especially with interactive web applications, and being able to use the same data structure as input to more than one type of chart.
However, this does conflict with just simple ease of use and consistency with the pandas plotting. For that, my ideal situation would be if there was a way to register a new plotting capability into pandas. But also the other way that could be done is via subclassing the dataframe with a special bokeh dataframe. I demonstrated how that could work here: Notebook :: Anaconda.org. You would override each plotting method, where you’d adapt the pandas interface to using the bokeh-equivalent chart. If there was any interest in this, I could try putting some more time into it.
-Nick
···
On Tuesday, May 3, 2016 at 11:59:20 PM UTC-5, [email protected] wrote:
On Wednesday, 27 April 2016 12:21:28 > > > > > > > UTC+10, nov...@[gmail.com](http://gmail.com) wrote:
I think the
matplotlib api may be too
ingrained in me as I can’t figure
out how to use bokeh to create a
simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred
to the examples and tried
multiple things with no luck so
would greatly appreciate it if
someone please show me how to
use the bokeh api to replicate
the below plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the
DataFrame contains the x-axis
labels, the columns are the
categories to stack and the
values are the values for each
label/category
TIA,
Dave
–
You received this message because you are
subscribed to the Google Groups “Bokeh
Discussion - Public” group.
To post to this group, send email to [email protected].
To view this discussion on the web visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io](http://continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io).
For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/optout](http://continuum.io/d/optout).
–
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
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/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
bokeh throws an unhelpful error message if the column labels aren’t strings
Could you file an issue for this with some info to reproduce the error so we can track this? I recall something about this but couldn’t find any open issue about this in a glance…
there appears no way to set the xlabel/ylabel values after the chart is created - fig.xlabel = xlabel has no effect
There is current work about this (and to alignt plotting.Figure and Chart API as much as possible). At the moment you need to call:
fig._xaxis.axis_label = ‘your label’
bokeh insists on title-casing the column labels
Sorry, I’m not sure I understand. You mean when it auto creates the axis labels or when you explicitly pass xlabel/ylabel? Could you provide an example?
Thanks
Fabio
-Dave
On Thursday, 28 April 2016 03:26:36 UTC+10, Sarah Bird wrote:
Hi,
Charts prefers long data. I learned this from here:
matplotlib api may be too
ingrained in me as I can’t figure
out how to use bokeh to create a
simple bar graph.
I'm probably just having a
brain-freeze but I’ve referred
to the examples and tried
multiple things with no luck so
would greatly appreciate it if
someone please show me how to
use the bokeh api to replicate
the below plot?
On the plus side it will
probably be a useful example for
others used to the
pandas/matplotlib api.
index =
pd.Index([1,2,3,4,5],
label=‘period’)
columns =
pd.Index([‘A’, ‘B’, ‘C’],
label=‘categories’)
values =
randint(10, 100,
15).reshape(5, 3)
values.sort(axis=0)
df =
pd.DataFrame(values, index,
columns)
df.plot.bar(stacked=True)
i.e. the index of the
DataFrame contains the x-axis
labels, the columns are the
categories to stack and the
values are the values for each
label/category
TIA,
Dave
–
You received this message because you are
subscribed to the Google Groups “Bokeh
Discussion - Public” group.
To post to this group, send email to [email protected].
To view this discussion on the web visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io](http://continuum.io/d/msgid/bokeh/1942a4e9-7f8e-488f-a51e-d2b9f2274070%40continuum.io).
For more options, visit [](https://groups.google.com/a/)[https://groups.google.com/a/](https://groups.google.com/a/)[continuum.io/d/optout](http://continuum.io/d/optout).
–
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
To view this discussion on the web visit [](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io)[https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/c4725c33-4f3b-410f-bef8-f67d805eee93%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).