graph alignment

44 views
Skip to first unread message

Stefan Seefeld

unread,
Sep 27, 2018, 9:42:06 PM9/27/18
to pyqtgraph

Hi all,

I'm using a GraphicsLayoutWidget to arrange multiple plots side-by-side. Now I'd like to align multiple plots horizontally (i.e. stack them vertically) such that they can all share the same X axis. The alignment I now get (simply calling `nextRow()` between plots) results in a slight (Y axis) misalignment due to the fact that the Y axis tic labels require different amounts of space in the various plots depending on the values to be printed there.

Is there a way to align the Y axes explicitly ?

Thanks,


Stefan
--

      ...ich hab' noch einen Koffer in Berlin...
    

tzin...@gmail.com

unread,
Sep 29, 2018, 4:55:40 AM9/29/18
to pyqtgraph
Hi Stefan,

      You can set width of the Y-Axis for each of your subplot using setWidth under  AxisItem. 

     For example:
  
>>> import pyqtgraph as pg
>>> graphic_window = pg.GraphicsWindow()
>>> graphic_window.nextRow()
>>> p = graphic_window.addPlot()
>>> p.getAxis('left').setWidth(120)

Reply all
Reply to author
Forward
0 new messages