# Tow subplots with different heights

**URL:** https://community.plotly.com/t/tow-subplots-with-different-heights/28275
**Category:** 📊 Plotly Python
**Created:** [September 5, 2019, 8:55pm UTC](https://community.plotly.com/t/tow-subplots-with-different-heights/28275 "2019-09-05T20:55:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rajaniesh](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/rajaniesh/32/7832_2.png) [@rajaniesh](https://community.plotly.com/u/rajaniesh)
#### Post date: [September 5, 2019, 8:55pm UTC](https://community.plotly.com/t/tow-subplots-with-different-heights/28275/1 "2019-09-05T20:55:25Z")

</div>

Hi,

I want to create two subplots with these specification:

X axis to be days till 60 days  
Y axis for second plot to be 24 hours starting from 1  
Y axis for first plot should for 1

I want to create the subplots one above other but when I use update\_layout method with height it changes the heights of both the subplots.

Regards  
Rajaniesh

---

<div class="post-metadata">

### Author: ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)
#### Post date: [September 9, 2019, 1:34pm UTC](https://community.plotly.com/t/tow-subplots-with-different-heights/28275/2 "2019-09-09T13:34:30Z")

</div>

Hi @rajaniesh Take a look at this tutorial, please: [https://plot.ly/python/subplots/](https://plot.ly/python/subplots/).

Update: To change the height of one of the subplots, you should modify its yaxis domain:

```auto
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import numpy as np
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Bar(y=[2, 3, 1]),
              row=1, col=1)
fig.add_trace(go.Scatter(x = np.random.rand(10),
                         y= np.random.rand(10),
                         mode='markers'), row=2, col=1)

```

If you are displaying `fig.layout` you’ll see how the two traces are mapped onto the square [0,1] x [0,1], i.e. in the normalized  
space. To change the height of the second cell just modifify `yaxis2_domain`

```auto

fig.layout
fig.layout
Layout({
    'template': '...',
    'xaxis': {'anchor': 'y', 'domain': [0.0, 1.0]},
    'xaxis2': {'anchor': 'y2', 'domain': [0.0, 1.0]},
    'yaxis': {'anchor': 'x', 'domain': [0.575, 1.0]},
    'yaxis2': {'anchor': 'x2', 'domain': [0.0, 0.425]}
})

```

This layout update shrinks the height of the lower subplot:

```auto
fig.update_layout(width =700, height=500,
                 yaxis2_domain = [0.2, 0.425])

```

 ![subplots-diff-h](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/e51b8e470ef251921fa0d805df908d1234043696.png)
