Reputation: 429
I would like to change the order of the subplots, e.g. by sorting by the mean, starting with the lowest. Currently: Blue, Red, Green. Desired: Red, Green, Blue
Any ideas? Thanks!
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(rows=3, cols=1, subplot_titles=('Blue', 'Red', 'Green'))
fig.append_trace(go.Scatter(
x=[3, 4, 5],
y=[1000, 1100, 1200],
), row=1, col=1)
fig.append_trace(go.Scatter(
x=[2, 3, 4],
y=[10, 11, 12]
), row=2, col=1)
fig.append_trace(go.Scatter(
x=[0, 1, 2],
y=[100, 110, 120],
), row=3, col=1)
fig.update_layout(height=600, width=600, title_text="Stacked Subplots")
fig.show()
Upvotes: 1
Views: 1496
Reputation: 9681
To change the order of the subplots, simply:
subplot_titles
parameter to order the titlesrow=
parameter of each plot to position the graph accordinglyHere's a link to that section of the Plotly docs. Albeit, says basically the same thing as the subplot docs you've reviewed.
Upvotes: 3