☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

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

Community Support
bisejdiu
bisejdiu

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'
⌁   Link to post
p-himik
p-himik

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.

⌁   Link to post

End of archived discussion · Replies are disabled