Mixed subplots not working

Hi @Gobrel ,

maybe itโ€™s the typo {"type": "yx"} instead of {"type": "xy"}?

Otherwise I canโ€™t reproduce your error:

import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np

# Initialize figure with subplots
fig = make_subplots(
    rows=2, 
    cols=2,
    column_widths=[0.5, 0.5],
    row_heights=[0.5, 0.5],
    specs=[
        [{"type": "xy"}, None],
        [{"type": "bar"}, {"type": "xy"}]
    ]
)

# first trace
fig.add_trace(
    go.Scatter(
        x=np.random.randint(1, 20, 20),
        y=np.random.randint(1, 20, 20),
        mode='markers',
        marker={'color': 'red'},
        showlegend=False
    ),
    row=1, col=1
)

# second trace
fig.add_trace(
    go.Bar(
        y=np.random.randint(1, 20, 20),
        marker={'color': 'green'},        
        showlegend=False,
    ),
    row=2, col=1
)

# third trace
fig.add_trace(
    go.Scatter(
        x=np.random.randint(1, 20, 20),
        y=np.random.randint(1, 20, 20),
        mode='markers',
        marker={'color': 'blue'},
        showlegend=False
    ),
    row=2, col=2
)
fig.update_layout(height=400,width=800)
fig.show()

creates:

1 Like