Does anyone know how to add x and y axis title/labels for a Bokeh figure? E.g. X-axis: time, Y-axis: stock price.
Thanks a lot!
layouts import gridplot from pandas import DataFrame from bokeh. plotting import figure, ColumnDataSource from bokeh. models import Range1d, HoverTool # output_file("bar. html") """ Adding some sample labels a few different ways.
The proper form for a graph title is "y-axis variable vs. x-axis variable." For example, if you were comparing the the amount of fertilizer to how much a plant grew, the amount of fertilizer would be the independent, or x-axis variable and the growth would be the dependent, or y-axis variable.
Change the format of numbers on the value axisRight-click the value axis labels you want to format, and then select Format Axis. In the Format Axis pane, select Number. Tip: If you don't see the Number section in the pane, make sure you've selected a value axis (it's usually the vertical axis on the left).
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With