Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

Multiple axis for one trace

Hey everyone,

could you please help me how can I make a graph with multiple axis corresponding to only one trace? I want to create a barchart that displays frequency as well as normalized counts at the same time.

Thank you for help,

Hey @lopyslav,

Here is an example of plot with two axes:

Thank you for the reaction.

I have seen this, but this does not solve my problem. This example uses 2 traces. When I delete one, the second axis disappears.

@lopyslav, Define data=[trace1, trace2], where trace2 is the same as trace1, but with


Also change the name in trace2.
In layout, the definition of yaxis2 is almost identical with yaxis1, except for title, and side.

Here is the resulting plot:

1 Like

Great. Thank you very much!

Then I will just turn off legend by showlegend=False on trace2 and it will be perfect.