2
votes

In regular (low level) plotting one can set label orientation like so:

p.xaxis.major_label_orientation = pi/4

per http://docs.bokeh.org/en/0.9.3/docs/user_guide/styling.html#tick-label-orientation

I want to set x axis label orientation to 'horizontal' in bokeh.charts.Bar and cannot find the way to do this.

Bokeh 0.9.3.

1

1 Answers

1
votes

The bokeh.charts API was deprecated and removed in 2017, and should not be used for anything at this point.

Since then, Bokeh support for categorical and bar plots in the well-supported bokeh.plotting API has gotten immensely better. It is now possible to rotate the axis labels on a bar chart in the standard way:

from math import pi
from bokeh.plotting import figure, show

types = list("ABCDE")
values = [10, 20, 50, 25, 35]

p = figure(x_range=types, plot_height=250)
p.vbar(x=types, top=values, width=0.9)

p.xaxis.major_label_orientation = pi/4   # standard styling code

show(p)

enter image description here

You can find more information and examples in the Handling Categorical Data section of the User's Guide.