shx2 shx2 - 11 months ago 126
Python Question

Two Y-scales in pyqtgraph (twinx-like)

How can I generate a plot with two Y-scales in


I also need the two in different colors (corresponding to lines' colors).

enter image description here

In matplotlib it can be done using
, as in this example.

If there's no way to do it with a single plot object, perhaps there's a way to overlay a plot (with y-axis on right side) on another one (with the y-axis on left)?

Answer Source

See pyqtgraph/examples/

The solution is just what you described--overlay two PlotItems.