Vertical spacing between make subplots

Hi,
I have to make 3 tables in a single figure to have them in 3 rows one col format. Using plotly I made a 3 X 1 subplot and added go.table objects to figure using add_trace.
Problem is gap between 1st and 2nd as well as 2nd and 3rd is quite big. I used vertical_spacing parameter but using a lower value only reduced gap between 1st and 2nd table not between 2nd and 3rd.

Any idea how it can be achieved?

Hi @Kash, welcome to the forum :slight_smile: ! Could you please post here a standalone code (maybe with dummy data) reproducing the issue? vertical_spacing should be the way to go, it should we the same space between all subplots, as below

import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(3, 1, vertical_spacing=0.05)
for i in range(3):
    fig.add_trace(go.Scatter(x=[1, 2], y=[2, 3]), i + 1, 1)
fig.update_layout(width=400)
fig.show()

Hi Emmanuelle,

Many thanks for your reply. Below is sample code. As in attached pic, there was huge gap between all tables. Changing vertical_spacing to even 0.0001 did not make much difference. I wanted tables to be right under each other with minute gap. Anyways your reply helped me to specify height of the layout and adjusting it accordingly.

But I have another scenario, my table rows count is dynamic based on data. Can I display all tables with variable height in this format (from top to bottom with variable height of individual table adjusted to show complete rows) ?? Trying to find some quick parameter kind of auto adjust/auto fit table heights.

fig_test = make_subplots(rows=3, cols=1, specs=[[{‘type’: ‘table’}],[{‘type’: ‘table’}],[{‘type’: ‘table’}]])

fig_test.add_trace(go.Table(header=dict(values=[‘A’, ‘B’]),cells=dict(values=[1,2])),row=1, col=1)
fig_test.add_trace(go.Table(header=dict(values=[‘See below’]), cells=dict(values=[“Blank”] )), row=2, col=1)
fig_test.add_trace(go.Table(header=dict(values=[‘C’, ‘D’]), cells=dict(values=[3,4])), row=3, col=1)

fig_test.update_layout( title_text=“Test”)
py.plot(fig_test, filename=‘Test.html’)