title: How can I have multiple left axisItems with the same alignment/position using pyqtgraph?
body: <p>I wonder if someone can help me out. I am trying to convert the MultiplePlotAxes.py example in pyqtgraph so that the all the axes are on the right side and aligned. Here is my code which I have added an extra plot:</p>
  
  <pre><code>"""
  Demonstrates a way to put multiple axes around a single plot.
  (This will eventually become a built-in feature of PlotItem)
  """
  #import initExample  ## Add path to library (just for examples; you do not need this)
  
  import pyqtgraph as pg
  from pyqtgraph.Qt import QtCore, QtGui
  import numpy as np
  
  pg.mkQApp()
  
  pw = pg.PlotWidget()
  pw.show()
  pw.setWindowTitle('pyqtgraph example: MultiplePlotAxes')
  p1 = pw.plotItem
  p1.setLabels(left='axis 1')
  
  ## create a new ViewBox, link the right axis to its coordinate system
  p2 = pg.ViewBox()
  p1.showAxis('right')
  p1.scene().addItem(p2)
  p1.getAxis('right').linkToView(p2)
  p2.setXLink(p1)
  p1.getAxis('right').setLabel('axis2', color='#0000ff')
  
  ## create third ViewBox.
  ## this time we need to create a new axis as well.
  p3 = pg.ViewBox()
  ax3 = pg.AxisItem('right')
  p1.layout.addItem(ax3, 2, 3)
  p1.scene().addItem(p3)
  ax3.linkToView(p3)
  p3.setXLink(p1)
  ax3.setZValue(-10000)
  ax3.setLabel('axis 3', color='#ff0000')
  
  ## create forth ViewBox.
  ## this time we need to create a new axis as well.
  p4 = pg.ViewBox()
  ax4 = pg.AxisItem('right')
  p1.layout.addItem(ax4, 2, 4)
  p1.scene().addItem(p4)
  ax4.linkToView(p4)
  p4.setXLink(p1)
  ax4.setZValue(-10000)
  ax4.setLabel('axis 4', color='#2EFEF7')
  
  ## Handle view resizing
  def updateViews():
      ## view has resized; update auxiliary views to match
      global p1, p2, p3, p4
      p2.setGeometry(p1.vb.sceneBoundingRect())
      p3.setGeometry(p1.vb.sceneBoundingRect())
      p4.setGeometry(p1.vb.sceneBoundingRect())
  
      ## need to re-update linked axes since this was called
      ## incorrectly while views had different shapes.
      ## (probably this should be handled in ViewBox.resizeEvent)
      p2.linkedViewChanged(p1.vb, p2.XAxis)
      p3.linkedViewChanged(p1.vb, p3.XAxis)
      p4.linkedViewChanged(p1.vb, p4.XAxis)
  
  updateViews()
  p1.vb.sigResized.connect(updateViews)
  
  p1.plot([1, 2, 4, 8, 16, 32])
  p2.addItem(pg.PlotCurveItem([1, 2, 4, 9, 16, 32], pen='b'))
  p3.addItem(pg.PlotCurveItem([1, 2, 4, 7, 16, 32], pen='r'))
  p4.addItem(pg.PlotCurveItem([1, 3, 5, 7, 17, 32], pen='c'))
  
  ## Start Qt event loop unless running in interactive mode or using pyside.
  if __name__ == '__main__':
      import sys
  
      if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
          QtGui.QApplication.instance().exec_()
  </code></pre>
  
  <p>This produces the following picture which I have added a red arrow showing what I want to do. 
  <a href="https://i.stack.imgur.com/Pvoa5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pvoa5.png" alt="enter image description here"></a></p>
  
  <p>Based on what I have been able to figure out I can do this using pg.GraphicsLayout(). However, the axisItem directly associated with plotItem and the created axisItems don't match because the one attached to the plotitem is smaller.</p>
  
  <p>Here is a picture of what I believe is happening:</p>
  
  <p><a href="https://i.stack.imgur.com/RU60v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RU60v.png" alt="enter image description here"></a></p>
  
  <p>This is my problem as I want them to all align. In the attached code you can addItem(axes,2,1) to the right but it doesn't work on the left. Anyone know how I can do this?</p>
  
  <p>Thanks in advance for any help you can provide.</p>