plot a figure which x axis is strings rather than numbers

Hi all, I want to plot a figure like above.

my xlist is [‘a’,‘b’,‘c’,‘d’]

my ylist is [98,88,90,20]

I read the bokeh doc but not find proper API for plotting a figure like above.

Can somebody help? Thanks!

I would suggest creating an algorithm that creates a representative number for each element in the string.

···

On Sun, Jul 10, 2016 at 9:02 AM, Luke Adolph [email protected] wrote:

Hi all, I want to plot a figure like above.

my xlist is [‘a’,‘b’,‘c’,‘d’]

my ylist is [98,88,90,20]

I read the bokeh doc but not find proper API for plotting a figure like above.

Can somebody help? Thanks!

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/0a571236-b3e4-4896-bd91-df8d5e668091%40continuum.io.

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

Ben Apple MsIA, CISA, CISSP, CISM, CIA

I was going to suggest the following but it doesnt work. Posting anyway for posterity.

It doesnt work on python 2.7 or 3.5 for me, using latest bokeh & seaborn.

The seaborn plotting library happily takes data like that to a figure - https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.barplot.html

It returns a matplotlib set of objects/axis, so you could use it with Bokeh - http://bokeh.pydata.org/en/latest/docs/user_guide/compat.html#matplotlib-seaborn-ggplot-and-pandas

Code something like this -

from bokeh import mpl
from bokeh.plotting import output_file, show

import seaborn as sns

x = [‘a’,‘b’,‘c’,‘d’]

y = [98,88,90,20]

sns.barplot(x=x,y=y)

output_file(“seaborn_barplot.html”, title=“example”)

show(mpl.to_bokeh())

``

···

On Sunday, 10 July 2016 14:02:44 UTC+1, Luke Adolph wrote:

Hi all, I want to plot a figure like above.

my xlist is [‘a’,‘b’,‘c’,‘d’]

my ylist is [98,88,90,20]

I read the bokeh doc but not find proper API for plotting a figure like above.

Can somebody help? Thanks!