Skip to content

accept int for rows and cols in fig.add_traces #2410

Closed
@emmanuelle

Description

@emmanuelle

At the moment if you want to add several traces to the same subplot you have to pass an iterable to the rows and cols arguments of fig.add_traces.

import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x='total_bill', y='tip', color='day')
from plotly.subplots import make_subplots
fig2 = make_subplots(1, 2)
fig2.add_traces(fig.data, rows=[1,]*len(fig.data), cols=[1,]*len(fig.data))
fig2.show()

We could also accept an int here, in which case all traces would be added to the same subplot.

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