This answer is an update for the more recent 0.12.4 version of Bokeh. For additional information, these commands are taken from the Styling Visual Attributes page of the Bokeh documentation.
To turn off the major and minor tick marks set their color to None
:
p = bokeh.plotting.figure(plot_width=400, plot_height=400)
p.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p.xaxis.major_tick_line_color = None # turn off x-axis major ticks
p.xaxis.minor_tick_line_color = None # turn off x-axis minor ticks
p.yaxis.major_tick_line_color = None # turn off y-axis major ticks
p.yaxis.minor_tick_line_color = None # turn off y-axis minor ticks
To turn off the tick labels set the font size to '0pt'
:
p.xaxis.major_label_text_font_size = '0pt' # turn off x-axis tick labels
p.yaxis.major_label_text_font_size = '0pt' # turn off y-axis tick labels
A similar result can be achieved by setting the font color to `None', with the disadvantage that space is still maintained for the tick labels.
p.xaxis.major_label_text_color = None # turn off x-axis tick labels leaving space
p.yaxis.major_label_text_color = None # turn off y-axis tick labels leaving space
This code snippet exemplifies removing both the major and minor tick lines and also the tick labels.
import bokeh.io
import bokeh.plotting
import bokeh.layouts
bokeh.io.output_file('remove_tick_marks.html')
p0 = bokeh.plotting.figure(plot_width=200, plot_height=200,
x_axis_label='x', y_axis_label='y',
title='original')
p0.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p1 = bokeh.plotting.figure(plot_width=200, plot_height=200,
x_axis_label='x', y_axis_label='y',
title='remove tick marks')
p1.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p1.xaxis.major_tick_line_color = None # turn off x-axis major ticks
p1.xaxis.minor_tick_line_color = None # turn off x-axis minor ticks
p1.yaxis.major_tick_line_color = None # turn off y-axis major ticks
p1.yaxis.minor_tick_line_color = None # turn off y-axis minor ticks
p2 = bokeh.plotting.figure(plot_width=200, plot_height=200,
x_axis_label='x', y_axis_label='y',
title='remove tick labels')
p2.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p2.xaxis.major_tick_line_color = None # turn off x-axis major ticks
p2.xaxis.minor_tick_line_color = None # turn off x-axis minor ticks
p2.yaxis.major_tick_line_color = None # turn off y-axis major ticks
p2.yaxis.minor_tick_line_color = None # turn off y-axis minor ticks
p2.xaxis.major_label_text_font_size = '0pt' # preferred method for removing tick labels
p2.yaxis.major_label_text_font_size = '0pt' # preferred method for removing tick labels
p3 = bokeh.plotting.figure(plot_width=200, plot_height=200,
x_axis_label='x', y_axis_label='y',
title='notice extra space')
p3.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p3.xaxis.major_tick_line_color = None # turn off x-axis major ticks
p3.xaxis.minor_tick_line_color = None # turn off x-axis minor ticks
p3.yaxis.major_tick_line_color = None # turn off y-axis major ticks
p3.yaxis.minor_tick_line_color = None # turn off y-axis minor ticks
p3.xaxis.major_label_text_color = None #note that this leaves space between the axis and the axis label
p3.yaxis.major_label_text_color = None #note that this leaves space between the axis and the axis label
grid = bokeh.layouts.gridplot([[p0, p1, p2, p3]])
bokeh.io.show(grid)
