✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly Express subplots: space between subplots for labels


I am currently using the following plotly express syntax to generate two subplots:

fig = px.line(
fig.update_yaxes(showticklabels=True, nticks=20)

The output looks as follows:

I would like to provide some spacing between the left plot and the yaxis labels of the right plot. Would be nice if there was some dynamic way to space it as I have some charts that can have 3(-4) digits.

Thanks in advance!!

Hi @hiqbal2

Try adding to your figure:

Your options are float between 0 and 1. The default is 0.02.

You can do the same thing with rows. See more here.

1 Like