Hi @rajaniesh Take a look at this tutorial, please: https://plot.ly/python/subplots/.
Update: To change the height of one of the subplots, you should modify its yaxis domain:
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
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:
fig.update_layout(width =700, height=500,
yaxis2_domain = [0.2, 0.425])