# Plotting data only on secondary\_y axes ignores subplot grid

**URL:** <https://community.plotly.com/t/plotting-data-only-on-secondary-y-axes-ignores-subplot-grid/76279>\
**Category:** 📊 Plotly Python\
**Tags:** bug-reporter\
**Created:** [June 21, 2023, 9:44am UTC](https://community.plotly.com/t/plotting-data-only-on-secondary-y-axes-ignores-subplot-grid/76279 "2023-06-21T09:44:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zalex86](https://avatars.discourse-cdn.com/v4/letter/z/7cd45c/32.png) [@zalex86](https://community.plotly.com/u/zalex86)\
**Post date:** [June 21, 2023, 9:44am UTC](https://community.plotly.com/t/plotting-data-only-on-secondary-y-axes-ignores-subplot-grid/76279/1 "2023-06-21T09:44:06Z")

</div>

Hello,

running the following code will produce a 2x2 subplot grid with data on the primary\_y axes and data on one secondary\_y axes.

```auto
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import numpy as np

rows = 2
cols = 2

fig = make_subplots(rows=rows, cols=cols, specs=[[{"secondary_y": True}] * cols] * rows)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name='1:1 primary_y',),
              secondary_y=False, row=1, col=1)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'1:2 primary_y',),
              secondary_y=False, row=1, col=2)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'2:1 primary_y',),
              secondary_y=False, row=2, col=1)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'2:2 primary_y',),
              secondary_y=False, row=2, col=2)

# plot on secondary_y
fig.add_trace(go.Scatter(x=np.arange(5) + 1, y=np.arange(5), name=f'2:2 secondary_y',),
              secondary_y=True, row=2, col=2)

fig.update_layout(height=400, width=600)

fig.write_html('test_bug.html')

```

![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/4/e4c8c46208754f3c0df9bb18a5a2c2fb715f6a75.png)

however if you don’t plot any data on a primary\_y axes but leave the data on the secondary\_y axes the height of the axes will take up the whole height of the figure

```auto
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import numpy as np

rows = 2
cols = 2

fig = make_subplots(rows=rows, cols=cols, specs=[[{"secondary_y": True}] * cols] * rows)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name='1:1 primary_y',),
              secondary_y=False, row=1, col=1)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'1:2 primary_y',),
              secondary_y=False, row=1, col=2)

fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'2:1 primary_y',),
              secondary_y=False, row=2, col=1)

# fig.add_trace(go.Scatter(x=np.arange(5), y=np.arange(5), name=f'2:2 primary_y',),
# secondary_y=False, row=2, col=2)

# plot on secondary_y
fig.add_trace(go.Scatter(x=np.arange(5) + 1, y=np.arange(5), name=f'2:2 secondary_y',),
              secondary_y=True, row=2, col=2)

fig.update_layout(height=400, width=600)

fig.write_html('test_bug.html')

```

![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/2/5/25b40b194ec40bf8e55682bea96e7f843307955b.png)

is this behaviour intentional?
