-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[BUG] X-axis order does not work in subplots #1163
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
Comments
Hi @slazicoicr - looks like you've uncovered a bug in plotly.js - thanks for the report! Until we get that fixed, can I suggest you use def update_graph_multi_timeseries(_clicks, ts_selected):
fig = make_subplots(
rows=2,
cols=1,
shared_xaxes=True,
shared_yaxes=False,
)
autorange = True if ts_selected == "asc" else "reversed"
plot = df.copy().sort_values('col1', ascending=True)
x = list(plot['col1'])
y1 = list(plot['col2'])
y2 = list(plot['col3'])
print(x)
fig.append_trace(
{'x': x,
'y': y1,
'mode': 'markers',
'name': 'single_trace'},
1, 1
)
fig.append_trace(
{'x': x,
'y': y2,
'mode': 'markers',
'name': 'single_trace'},
2, 1
)
fig["layout"].update(
autosize=True,
template="plotly_white"
)
fig.update_xaxes(autorange=autorange)
return fig, {
'data': [
{'x': x,
'y': y1,
'mode': 'markers',
'name': 'single_trace'}
],
'layout': {
'xaxis': {'autorange': autorange}
}
} Unfortunately that won't work if the change you're making is any more granular than a reversal (sorting on some other attribute, for example) and this bug is still present even if you explicitly specify the |
@archmoj this looks like a |
Tracked in plotly/plotly.js#4718. |
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson |
Describe your context
Describe the bug
I have set up a subplot and a normal plot, where the input x-axis is reversed when the button is clicked. It displays correctly in the single plot, but the subplot fails to change axis order:
Expected behavior
Subplot should respect the x-axis order supplied by the traces.
Screenshots

Initial state of app:
Subplot retains initial state, whereas single plot correctly changes order:

The text was updated successfully, but these errors were encountered: