accept int for rows and cols in `fig.add_traces`
See original GitHub issueAt 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
plotly.subplots.make_subplots — 5.11.0 documentation
Figure with predefined subplots configured in 'layout'. Parameters. rows (int (default 1)) – Number of rows in the subplot grid. Must be greater...
Read more >how to plot multiple charts using make_subplot in plotly and ...
1 Answer 1 · 1 · In the example shown in the comments, the graph has nine columns and two rows. · so...
Read more >plotly package — 5.11.0 documentation - Plotly Help Center
row (int or None (default None)) – Subplot row and column index of traces to select. To select traces by row and column,...
Read more >Creating Various Plot Types and Subplots with Plotly
All we have to do now is when we add a trace to our figure, we need to provide a row and column...
Read more >How to apply different titles for each different subplots using ...
Syntax: make_subplots(rows=int, cols=int, subplot_titles= 'title'). Parameters: ... In this example, we have selected 1 row with 2 columns, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MCBoarder289 if you’re interested, solving this issue might involve the same area of the code you were just in 😃
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 😃