X and Y axis labels for Bokeh figure X and Y axis labels for Bokeh figure python python

X and Y axis labels for Bokeh figure


As of Bokeh 0.11.1, the user's guide section on axes now shows how to edit properties of existing axes. The way to do it is the same as before:

p = figure(width=300, height=300, x_axis_label='Initial xlabel')p.xaxis.axis_label = 'New xlabel'


Check out this example: elements.py

You can also now give general plot related options (plot_width, title, etc.) to a call to figure(...) instead of the renderer function (circle, in that example)


This is how you can change the axis label using CustomJS:

p = figure(x_axis_label="Initial y-axis label",           y_axis_label="Initial x-axis label")# ...# p.xaxis and p.yaxis are lists. To operate on actual the axes,# we need to extract them from the lists first.callback = CustomJS(args=dict(xaxis=p.xaxis[0],                              yaxis=p.yaxis[0]), code="""    xaxis.axis_label = "Updated x-axis label";    yaxis.axis_label = "Updated y-axis label";""")