Skip to content

tools.make_subplots with colspan/rowspan fails when using sharex/sharey #1209

@claria

Description

@claria

Hi,
i am trying to create subplots with colspan/rowspan attribute and shared_xaxes using the code below (Plotly 3.3). As soon as i use the shared_xaxes=True parameter, the code fails with the error message:

Exception: Something went wrong. An axis object for (2,4) subplot cell got deleted.

Example code:

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

trace1 = go.Scatter(
    x=[0, 1, 2],
    y=[10, 11, 12]
)
trace2 = go.Scatter(
    x=[2, 3, 4],
    y=[100, 110, 120],
)
trace3 = go.Scatter(
    x=[2, 3, 4],
    y=[100, 110, 120],
)

fig = tools.make_subplots(rows=3, cols=4, specs=[[{'colspan':3}, None, None, None], 
                                                [{'rowspan':2, 'colspan':3}, None, None, {'rowspan':2}], 
                                                [None, None, None, None]],
                          shared_xaxes=True, shared_yaxes=True,
                          vertical_spacing=0.001)

print(fig['layout'])

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

print(fig['layout'])

fig['layout'].update(height=600, width=600, title='Stacked Subplots with Shared X-Axes')
plotly.offline.iplot(fig, filename='test')

Cheers,
Georg

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