I am working on the Bokeh (0.6.1) tutorial and trying to turn off the tick marks and labels in one of the exercise plots, the scatter plot:
from __future__ import division
import numpy as np
from six.moves import zip
from bokeh.plotting import *
from bokeh.objects import Range1d
output_file("scatter.html")
figure()
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
"#%02x%02x%02x" % (r, g, 150)
for r, g in zip(np.floor(50+2*x), np.floor(30+2*y))
]
circle(x, y, radius=radii,
fill_color=colors, fill_alpha=0.6,
line_color=None, Title="Colorful Scatter")
grid().grid_line_color = None
axis().axis_line_color = None
# QUESTION PART 1: Is this the right way to turn off tick labels?
axis().major_label_text_font_size = '0pt'
# QUESTION PART 2: ...and how to turn off tick marks also?
show() # open a browser
axis().major_label_text_font_size
0pt
I am not sure if the absence of an answer over more than a week is due to people not knowing it, or because the question is being ignored as too obvious.
Anyway, in the hope that others might find it useful, I post this answer. I have found a way of doing it that seems so much like a hack that I am only posting it in the hope that someone will improve on it...
from __future__ import division
import numpy as np
from six.moves import zip
from bokeh.plotting import *
output_file("scatter.html")
figure()
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = ["#%02x%02x%02x" % (r, g, 150)
for r, g in zip(np.floor(50+2*x), np.floor(30+2*y))]
circle(x, y, radius=radii,
fill_color=colors, fill_alpha=0.6,
line_color=None, Title="Colorful Scatter")
grid().grid_line_color = None
axis().axis_line_color = None
curplot().outline_line_color = None
# Turn off tick labels
axis().major_label_text_font_size = '0pt'
# Turn off tick marks
axis().major_tick_line_color = None # turn off major ticks
axis()[0].ticker.num_minor_ticks = 0 # turn off minor ticks
axis()[1].ticker.num_minor_ticks = 0
show() # open a browser