Size of plots without axis

18 views
Skip to first unread message

Jo B

unread,
Oct 17, 2020, 3:17:55 PM10/17/20
to pyqtgraph
Hello all,
I want to use have multiple plots with only one X axis, as shown in the GraphicsLayout example, where it seems to work as expected. But when I try it myself, the ViewBoxes of the items have different sizes, while I want (and would expect) the ViewBoxes to have the same size for all plots. I think it might be related to the size of the window - if the ViewBox is small, it seems to be correct, only if it grows, it gets out of proportion.
What am I doing wrong? How can I avoid this behavior?
Thanks,
Jo


import sys
from PySide2.QtWidgets import QApplication
import pyqtgraph as pg

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = pg.GraphicsLayoutWidget(border=(50, 0, 0))
    p1 = win.addPlot(y=[1, 3, 2])
    win.nextRow()
    p2 = win.addPlot(y=[3, 1, 2])
    p1.showAxis('bottom', False) # leaving this out makes the ViewBoxes same size
    win.show()
    sys.exit(app.exec_())


  viewbox_size.png

Reply all
Reply to author
Forward
0 new messages