I'm updating some code that was written in Chaco to use PyQtGraph instead. I'm working with relatively low-level primitives from PyQtGraph to maximize my control over the various components. For example, I am creating a GraphicsLayout, inserting a ViewBox and then adding the PlotCurveItem to the ViewBox.
One thing I would like to accomplish in a single ViewBox is to have multiple PlotCurveItems. However, each curve needs to be offset vertically relative to the axes coordinates. For example, if I have three plots, the plots would be spaced equally along the vertical axis. However, when I use the mouse wheel to scale the Y-axis, it should scale the plot (but not the position of the plot).
This is easy to accomplish in Matplotlib using their transform system. For example, I would do:
import matplotlib as mp
import pylab as pl
import numpy as np
ax = pl.gca()
x = np.arange(100)
y = np.random.uniform(-1, 1, size=100)
offset_transform = mp.transforms.Affine2D().translate(0, 0.25)
new_transform = ax.transLimits + offset_transform + ax.transAxes
ax.plot(x, y, 'ro-', transform=new_transform)
offset_transform = mp.transforms.Affine2D().translate(0, 0.5)
new_transform = ax.transLimits + offset_transform + ax.transAxes
ax.plot(x, y, 'go-', transform=new_transform)
offset_transform = mp.transforms.Affine2D().translate(0, 0.75)
new_transform = ax.transLimits + offset_transform + ax.transAxes
ax.plot(x, y, 'bo-', transform=new_transform)
#ax.axis(ymin=0, ymax=5)
pl.show()
Does PyQtGraph have a similar system?