Grid lines at x = 0 and y = 0 do not change color

I am trying to make a line plot with Plotly on python version 3.10 using plotly version 5.15.0. I want to change the background color to white and the grid colors for both x and y axis to light grey. When I perform this and center the plot at x = 0, y = 0 the gird lines for x = 0 and y = 0 do not change color

I have tried different OS (Mac, Linux) tried different versions of python as well as downgraded to 5.9.0 for plotly. Still having the same issue.

I wonder if this is the same issue I found with the polar plot - see my other post.

In my case I hadn’t realised that the main axis lines at x and y = 0 are coloured using the property linecolor and not the gridcolor. Setting both worked in my case!

Hi @tstone , @Brutha

there are two types of lines which compose the grid:

gridlines
zerolines

Here an example:

import plotly.express as px
import numpy as np

fig = px.scatter(x=np.arange(20), y=np.random.randint(-20, 20, 20))
fig.update_layout({'plot_bgcolor': 'darkgrey', 'paper_bgcolor': 'black'})
fig.update_xaxes({'gridcolor': 'red', 'zerolinecolor': 'blue', 'linecolor': 'white', 'linewidth': 5})
fig.update_yaxes({'gridcolor': 'green', 'zerolinecolor': 'yellow'})

This may have worked out in your case, but the axis line is different from the zeroline, see my updated post.

This worked for me, thank you for your help!