Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Two y axis for two independent series in plotly

I’d like to create simple plolty graphs in python for my two PCs. It’s simple graph of program runs vs time (hourly) on each PC. I’d like those graphs to have a common x axis, to easily compare data between PCs when mouse hovers over the chart.

How do I do this? Is there a tutorial I can follow? I couldn’t find anything on the tutorials site.

Also I’ve linked that to same question on StackOverflow:

@hubert Here is an example of plot with left and right yaxis:

@empet I think that vou’ve missed my point here. I do not want to have two sets of data on one plot (as I want to present data for different machines). I need one y axis over another.
The difference between my attempt and two separate plots, is jost one: when I hoover over one point on plot (eg.x=500, y=300), it will show me data on both plots. Please look on graphics on StackOverflow link

@hubert I don’t understand precisely what you want.

  1. Do you want two subplots in one column as the plots posted on stackoverflow with a shared xaxis?
    If this is the case you should define:

    fig = tools.make_subplots(rows=2, cols=1,

With such a definition you cannot display tooltips on both subplots simultaneously. When you hover over one subplot only information in that subplot is displayed.

2)What to do mean by “one y axis over another”? Both yaxes on the left side of the plot?

The only solution at the moment is to insert the two plots on the same window as in the example I posted. Obviously instead of bars and line in my plot you should insert your lines.

1 Like

Yep, what i needed was subplots with shared xaxes, thank you @empet for support and help :slight_smile: