-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Cannot set x-axis to side='top' for second chart in subplot with shared_yaxes=True #1553
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 @kasparthommen, Thanks for the report. I'm not exactly sure what's going wrong with the current version of from _plotly_future_ import v4_subplots
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
trace_left = go.Scatter(x=[3, 2, 5], y=[1, 2, 3], name='Left')
trace_right = go.Scatter(x=[2, 6, 7], y=[1, 2, 4], name='Right')
fig = tools.make_subplots(rows=1, cols=2, specs=[[{}, {}]], shared_yaxes=True)
fig.append_trace(trace_left, 1, 1)
fig.append_trace(trace_right, 1, 2)
layout = go.Layout(
xaxis=dict(side='top'),
xaxis2=dict(side='top'), # <- 2nd x-axis should be on top as well but isn't
)
fig['layout'].update(layout)
iplot(fig, filename='issue') You can also make this a little bit more concise using the from _plotly_future_ import v4_subplots
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
trace_left = go.Scatter(x=[3, 2, 5], y=[1, 2, 3], name='Left')
trace_right = go.Scatter(x=[2, 6, 7], y=[1, 2, 4], name='Right')
fig = tools.make_subplots(
rows=1,
cols=2,
shared_yaxes=True
).update_xaxes(side='top')
fig.append_trace(trace_left, 1, 1)
fig.append_trace(trace_right, 1, 2)
iplot(fig, filename='issue') |
Hi @jonmmease Thanks for your reply, I'll try that! I assume this means that there won't be a fix for the current version? If so then please feel free to mark this issue as closed/wont-fix or whatever you see fit, thanks. |
Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson |
Hi all,
I'm trying to display two charts with shared y-axes side-by side and with their respective x-axes shown at the top. This works for the 1st chart on the left, but not for the 2nd one on the right, see the minimal example below. Am I doing something wrong or is this a bug?
Note that it works fine if I change
shared_yaxes
toFalse
but I really need them shared.The text was updated successfully, but these errors were encountered: