I’m attempting to make a horizontal bar chart as per here (http://bokeh.pydata.org/en/latest/docs/reference/models/glyphs/hbar.html). I managed to produce a ‘normal’ bar chart using high level charts but I’ve been advised that this one will look better. It just doesn’t show up with anything. I want there to be strings on y-axis and the numbers on x-axis. I’d appreciate any advice.
Attempting to make a horizontal bar chart
import numpy as np
from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import HBar
from bokeh.io import curdoc, show
N = 12
y = esc_per_vert[‘vertical’]
x = esc_per_vert[‘perc_churned’]
source = ColumnDataSource(dict(y=y, right=x,))
xdr = DataRange1d()
ydr = DataRange1d()
plot = Plot(
title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
glyph = HBar(y=“y”, right=“right”, left=0, height=0.5, fill_color="#b3de69")
plot.add_glyph(source, glyph)
xaxis = LinearAxis()
plot.add_layout(xaxis, ‘below’)
yaxis = LinearAxis()
plot.add_layout(yaxis, ‘left’)
plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
curdoc().add_root(plot)
show(plot)