I am trying to rotate the axis tittle of the yaxis of a bokeh figure. I cannot seem to find an option for this. Happy if anyone got a solution. I am actually in need to have this workig into holoviews/hvplot using the bokeh backend, but have not found a way supporting this.
What have you tried that did NOT work as expected?
I have tried to modify the major_label_orientation, but that is the labels for the major ticks.
Code example for jupyter notebook:
# Imports
import bokeh
import pandas as pd
import numpy as np
from bokeh.plotting import figure, ColumnDataSource, show, output_notebook
output_notebook()
# Create dummy data
xs = np.linspace(10,20, 11)
ys = np.random.random(len(xs)).cumsum()
data = {
'x': xs,
'y': ys
}
data
df = pd.DataFrame(data)
source = ColumnDataSource(df)
# Make plot
p = figure(frame_height=40, width=700)
p.line(x='x', y='y', line_width=2, source=source)
p.yaxis.axis_label = 'long label that would like to be rotated'
show(p)
In some cases, a screenshot of your plot will also be helpful.
If I have a long axis title I have issues fitting it. Would be nice if possible to rotate or wrap it.
Searching for an option like ‘p.yaxis.axis_label_orientation’
Happy to learn a good trick on this.