Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Three (or more) y-axes in a sub-plot

Hi all,

I’ve been trying to add 3 line traces to an individual subplot in a 2x2 subplot configuration in Plotly. Each trace needs its own individual y-axis in the sub-plot. It’s can’t share a y-axis in the subplot with any other trace.

It seems like Plotly functionality limits the number of sub-plot y-axes to 2 (primary and secondary). For a normal plot though (not sub-plot), it allows 3 or more.

To provide some sample code, in the Plotly Fundamentals graphing library, there are 2 examples that describe what I am trying to do (Found here --> https://plotly.com/python/multiple-axes/).

1.) In the second example, there are 4 subplots, each with 2 y-axes (primary and secondary).
2.) In the third example, there is a single plot (no subplots) with 4 y-axes plotted on the same graph. Each with a unique y-range and title.

I want to combine these two examples into one - multiple subplots, multiple traces (3 or more), and multiple y-axes (3 or more).

If you were to combine the two example from the Plotly Fundamentals library (as linked-to above), the output would look like this…

Obviously the formatting is messed-up because I just copied and pasted pictures, but I think you will get the point.

I’d appreciate if someone could help me out here. Would like to know if this is possible, and if it is, some examples would be awesome.

A group of us have been trying to crack this, and have had no success. Also, I’ve been unable to find any examples in the forums explaining this.

@robbohn14

Welcome to Plotly forum!
Based on previous examples given for another forum question related to subplots with multiple yaxes, I succeeded to define a subplot like in your image above.
https://chart-studio.plotly.com/~empet/15704

1 Like

Thank you so much!

Your explanation was really easy to follow.
I appreciate the quick reply too.

Our group was able to figure out what we were doing wrong using your examples.
What we came up with is below.

Excuse the blacked-out title’s and images, the data is private and can’t be shared, but I though to share the concept at least so others can benefit.

Basically, it’s a heat map in the first subplot with three line traces in the second subplot below.

Hopefully this helps out someone else.