-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Adding multiple X axes to the same line #3948
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
This example on plotly forum can suggest how to reference a chart to the second xaxis ( the top one), and the default yaxis: |
Thanks for your quick answer @empet. |
In this case you should add that trace twice. fig.data[0] is referenced to xaxis, yaxis, and fig data[1] to xaxis2, yaxis. |
Do you mean like this? @empet
but if I do that, just changing the x data, it will generate other trace. Maybe I'm not understanding you. |
Without data I cannot run your code. |
Try this one @empet, thanks
|
If you want to get help, please post a working code. And also add the line:
Your code in the last cell, above, throws a lot of errors. |
Hi there @empet, sorry for the last comment. This is a working example.
As u can see when I add the second trace, it generates the coloured lines. I would want to have just the first trace added with the two axis without more lines added to them is that possible? |
You question related to referencing a trace to two xaxes is so fuzzy that I cannot understand why do you want to be displayed only the first trace. Please create a manual plot of what you want to get, and post here a CLEAR EXPLANATION of your data, and of this odd requirement to display two xaxes for a single trace. |
It's not such an odd request IMO. A simple example would be that I have a temperature curve in celsius but I also want a farenheit axis. Totally reasonable and easy to grok. One trace, two axes. Plotly's model is simply too rigid to allow for this right now because of the one-axis-per-trace model and the one-trace-per-axis requirement to display an axis. |
@nicolaskruchten You are right with temperature, but in tens years of math I haven't seen a graph represented with respect to two xaxes, because the graph of a function consists in the points |
Closing as a duplicate of plotly/plotly.js#5076 |
This Stackoverflow post is about exactly this. It contains a visualization made in matplotlib, which clearly shows the case: |
Hey there,
I'm trying to create a plot in python using Plotly that allows me to add 2 x axis to a single plot. I just tried but every single tutorial and documentation add a second trace to the plot with y and x data, but if you do that it will generate a second line and I just want a line that represents both axis. I mean de mainly x axis will be the bottom one and the secondary can be the upper one. The plot will be generated using y and x data (from the mainly x axis).
I already have this, but as you can see is not very clear...

any idea? Thanks!
The text was updated successfully, but these errors were encountered: