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 bokeh.io import output_file from bokeh.plotting import figure, show # The figure will be rendered in a static HTML file # called output_file_test.html output_file('output_file_test.html', title='Empty Bokeh Figure') # Example figure fig = figure(background_fill_color='gray', background_fill_alpha=0.5, border_fill_color='blue', border_fill_alpha=0.25, plot_height=300, plot_width=500, # h_symmetry=True, This parameter has been deprecated x_axis_label='X Label', x_axis_type='datetime', x_axis_location='above', x_range=('2018-01-01', '2018-06-30'), y_axis_label='Y Label', y_axis_type='linear', y_axis_location='left', y_range=(0, 100), title='Example Figure', title_location='right', toolbar_location='below', tools='save') # Remove the gridlines from the figure() object fig.grid.grid_line_color = None # See what it looks like show(fig)