How do I remove grid lines from a Bokeh plot?

Question:

I would like to remove the grid lines from a Bokeh plot. What is the best way to do this?

Asked By: MRocklin

||

Answers:

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

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.

Answered By: Antony Hatchkins

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

Answered By: T – Gott

I think T-Gott’s answer better solves the original question: "remove the grid lines from a Bokeh plot".

Answered By: Alberto Hernandez
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.