adjusting x_axis_label or y_axis_label font/font size (Bokeh)

Jonathan Shore picture Jonathan Shore · Dec 18, 2014 · Viewed 9.2k times · Source

Is there a way to adjust x_axis_label and y_axis_label font/font size in Bokeh (0.70)? I am aware of a way to adjust title font size with the title_text_font_size property, with:

figure (..., title_text_font_size="12pt")

Is there a way to then specify something like:

figure (..., x_axis_label_text_font_size='10pt')

(using the convention of <name>_text_font_size) to indicate the font size property. The above did not work. If this is not present, could someone give some pointers as to how to make this sort of adjustment in the cofeescript + API-side of things, so can contribute back to the project? Thanks

Answer

Fabio Pliger picture Fabio Pliger · Dec 18, 2014

Figure exposes xaxis and yaxis attributes that you can use for that. In your use case it should be able to use:

p.xaxis.axis_label = 'whatever'
p.xaxis.axis_label_text_font_size = "40pt"

You can also adjust x and y labels simultaneously via the axis attribute:

p.axis.axis_label_text_font_style = 'bold'