I would like to remove the grid lines from a Bokeh plot. What is the best way to do this?
Asked
Active
Viewed 1.5k times
3 Answers
39
Have a look at the Bokeh line styling documentation
You can hide the lines by setting their grid_line_color
to None
.
fig.xgrid.grid_line_color = None
fig.ygrid.grid_line_color = None

bigreddot
- 33,642
- 5
- 69
- 122

Nick is tired
- 6,860
- 20
- 39
- 51
-
1Note that the documentation for styling lines in the latest release version is here: http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#lines – Steven C. Howell May 11 '17 at 14:40
30
An alternative way to hide the lines is:
p.xgrid.visible = False
p.ygrid.visible = False
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#visible-property
It might be faster, but I didn't check it out.

bigreddot
- 33,642
- 5
- 69
- 122

Antony Hatchkins
- 31,947
- 10
- 111
- 111
5
You can write
p.grid.visible = False
which will make both xgrid
and ygrid
invisible at the same time.
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#styling-grids

timgo
- 345
- 3
- 6