Skip to content

make_subplots(row_width=[]) is parsed in the 'wrong' order #1275

Closed
@EBoisseauSierra

Description

@EBoisseauSierra

Imagine have 3 subplots stacked one above the other. I want the first (i.e. the top one) to have its height twice as big as the others.
So after I have set:

fig = tools.make_subplots(
      rows=3, 
      cols=1,
      subplot_titles=('subtitle 1', 'subtitle 2', 'subtitle 3'),

… I intuitively set (thanks to @Kully 's previous PR):

      row_width=[2, 1, 1]
)

However, this makes the 3rd graph (i.e. the "first… from last") have its height twice as big as the others:

plot from api 3

I believe that row_width is parsed in the wrong direction.


MWE

from plotly import tools
import plotly.plotly as py
import plotly.graph_objs as go

trace1 = go.Scatter(
    x=[3, 4, 5],
    y=[1000, 1100, 1200],
)
trace3 = go.Scatter(
    x=[0, 1, 2],
    y=[10, 11, 12]
)
trace2 = go.Scatter(
    x=[2, 3, 4],
    y=[100, 110, 120],
)
fig = tools.make_subplots(
      rows=3,
      cols=1,
      shared_xaxes=True,
      vertical_spacing=0.1,
      subplot_titles=('subtitle 1', 'subtitle 2', 'subtitle 3'),
      row_width=[2, 1, 1]
)

fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 2, 1)
fig.append_trace(trace3, 3, 1)

fig['layout'].update(height=600, width=600, title='Subplots with Shared X-Axes')

plot_url = py.plot(fig)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions