Hide grid of secondary_y axis

I’m trying to figure out if it’s possible to hide the automatically generated y-axis gridlines from a secondary_y axis, so that only the y-axis grid from the left hand side axes are drawn.

In one of the examples at https://plot.ly/python/multiple-axes/ under ‘Muliple Y-Axes Subplots’ demonstrates my issue, y-axis grid lines are drawn for both left and right side which results in twice as many unevenly spaced lines if the axis ticks are not aligned. If I disable the left hand side y-axis grid lines via

fig[layout][yaxis][showgrid] = False

the right hand side y-axis grid lines are still drawn).

I’ve tried the following but it doesn’t work:

fig.update_traces(yaxis_showgrid=False, selector={'secondary_y': True})

Photo for reference:

Anyone have any tips?

By printing fig I realised the right hand side y axis is ‘yaxis2’ and the following works:

figure['layout']['yaxis2']['showgrid'] = False

Thanks for posting! You might want to post the solution in #api:python to help other python users.