Overlapping rows of plots in GraphicsLayout

73 views
Skip to first unread message

Clemens Brunner

unread,
Feb 9, 2021, 10:56:29 AM2/9/21
to pyqtgraph
Hello!

I would like to create multiple plots in rows, which is relatively straightforward using pg.GraphicsLayout() and the addPlot() method. However,  rows created like that do not overlap. Is there a way how I can (gradually) let them overlap so that the plots e.g. overlap by 20% on the y-axis?

Thanks!
Clemens

Patrick

unread,
Feb 9, 2021, 11:13:20 PM2/9/21
to pyqtgraph
Hi,

I really don't know if this will work, but since GraphicsLayout uses a Qt QGraphicsGridLayout internally to position the plots, you could try setting negative spacing for it. Maybe something like:

graphicslayout.layout.setRowSpacing(row=0, -50)

If that doesn't accept negative values, then I'm not too sure. I believe it's possible to put two plots into the same row and column of the layout, and maybe you could then adjust each plots alignment and size. Anyway, hopefully looking through the QGraphicsGridLayout API might give some ideas.

Patrick

Clemens Brunner

unread,
Feb 10, 2021, 3:11:01 AM2/10/21
to pyqtgraph
Thanks Patrick! Unfortunately, negative spacings don't work with QGraphicsGridLayout objects. In fact, I didn't find a layout which does support overlapping items.

Since I have much more than two plots, it would be cumbersome to try to put all in one cell.

I had one last idea which I'm not sure will work either, but is it possible to disable (vertical) clipping for a given viewbox? I didn't find anything in either the PyQtGraph or the Qt API, but maybe I missed something.

If nothing works, I guess writing a custom layout based on QGraphicsLayout which supports overlapping rows would still be an option.

Clemens

Reply all
Reply to author
Forward
0 new messages