Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
emmanuelle opened this issue Apr 25, 2020 · 8 comments · Fixed by #2546
Closed

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

emmanuelle opened this issue Apr 25, 2020 · 8 comments · Fixed by #2546

Comments

@emmanuelle
Copy link
Contributor

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.

@nicolaskruchten
Copy link
Contributor

Did you close this because it's working now or because you no longer think this is a good idea?

@emmanuelle
Copy link
Contributor Author

Because it was fixed by #2451 (sorry for being lazy here!)

@nicolaskruchten
Copy link
Contributor

so this is the same as #2391 ?

@emmanuelle emmanuelle reopened this Jun 4, 2020
@emmanuelle
Copy link
Contributor Author

ok I got mixed up here. This is not solved by #2391 (more flexible type of int), it's something different (relaxing the iterable constraint). So I'm reopening it...

@nicolaskruchten
Copy link
Contributor

Ah ok, thanks for following up :) should #2391 be closed now then?

@nicolaskruchten
Copy link
Contributor

@MCBoarder289 if you're interested, solving this issue might involve the same area of the code you were just in :)

@MCBoarder289
Copy link
Contributor

@nicolaskruchten Thanks! I'll take a look and see what I can do here

@nicolaskruchten
Copy link
Contributor

Awesome! Please don't feel any pressure to work on it or anything, I was just flagging it in case you were looking for a (possibly easy) entry-point into another PR here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants