Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Getting Your Figure Ready for Data

Give Feedback

In this video you learn how to get you figure ready for data. The figure() object is not only the foundation of your data visualization but also the object that unlocks all of Bokeh’s available tools for visualizing data.

The code below explores just a few of the cusomization options available.

Here are some other helpful links on this topic:

  • The Bokeh Plot Class is the superclass of the figure() object, from which figures inherit a lot of their attributes.
  • The Figure Class documentation is a good place to find more detail about the arguments of the figure() object.

Here are a few specific customization options worth checking out:

  • Text Properties covers all the attributes related to changing font styles, sizes, colors, and so forth.
  • TickFormatters are built-in objects specifically for formatting your axes using Python-like string formatting syntax.


# Bokeh Libraries
from import output_file
from bokeh.plotting import figure, show

# The figure will be rendered in a static HTML file
# called output_file_test.html
            title='Empty Bokeh Figure')

# Example figure
fig = figure(background_fill_color='gray',
             x_axis_label='X Label',
             x_range=('2018-01-01', '2018-06-30'),
             y_axis_label='Y Label',
             y_range=(0, 100),
             title='Example Figure',

# Remove the gridlines from the figure() object
fig.grid.grid_line_color = None

# See what it looks like

Comments & Discussion

Pygator on Aug. 18, 2019

you meant to import output_file in the example code. I’m already seeing a more recent version of the bokeh and how certain things have evolved like h_symmetry=True has been deprecated in my version of bokeh.

Chris Bailey RP Team on Aug. 21, 2019

Thanks for the note. I’m getting the output_file change made. Yes, it looks like they are moving along toward a version 2.

Ikones on Sept. 10, 2019

Thank you both. So what else should we use nowadays instead of h_symmetry=True for example, please?

Looking very much forward to the the update. (and aware it will take some time :-)

Ikones on Sept. 10, 2019

I am looking for the most efficient way to define a font-family for a whole figure or even plot (rather than doing it individually for the title etc. ) . Would you have any recommendations for me please?

Become a Member to join the conversation.