Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

X and Y axis labels for Bokeh figure

Tags:

python

bokeh

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!

like image 341
user3361508 Avatar asked Jun 10 '14 01:06

user3361508


People also ask

How do I add data labels in bokeh?

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.

How do you label Y-axis and X-axis?

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.

How do you assign Y-axis labels?

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).


2 Answers

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' 
like image 195
thorbjornwolf Avatar answered Sep 19 '22 17:09

thorbjornwolf


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)

like image 25
bigreddot Avatar answered Sep 21 '22 17:09

bigreddot