How do I change the direction/orientation of a bokeh plot

Hi everyone,

Given the following plot:

import numpy as np
from bokeh.plotting import figure, show

h, e = np.histogram(np.random.random(100), density=True)

p = figure()
p.quad(top=h, bottom=0, left=e[:-1], right=e[1:])

show(p)

How do I switch the position of (rotate) the plot axis, i.e. show the distribution horizontally by having the bins along the y axis, and their density on the x axis? Essentially, rotate the plot by 90 degrees counter-clockwise.

Thank you,

bokeh.__version__
'1.4.0'

Just change the quad parameters a bit:

p.quad(top=e[1:], bottom=e[:-1], left=0, right=h)

Note that it won’t rotate the plot, it will mirror it along the y = x line since both X and Y axes start from the same point.

2 Likes