Thanks Patrick, this worked for me. On Sunday, May 26, 2019 at 9:02:40 PM UTC-4, Patrick wrote: > > Hi, > > ImageItem is a descendent of Qt QGraphicsItem > <https://doc.qt.io/qt-5/qgraphicsobject-members.html>, so the real work > happens down there somewhere. Here's a an example of how I do what you > describe: > > # x, y are arrays of x and y axis labels, assumes regularly spaced grid > # imageItem has been added to the plotItem > > x_scale = (self.x[-1] - self.x[0])/(self.x.shape[0]-1) if self.x.shape[0] > > 1 else 1.0 > y_scale = (self.y[-1] - self.y[0])/(self.y.shape[0]-1) if self.y.shape[0] > > 1 else 1.0 > > self.plotItem.setLimits(xMin=self.x[0] - x_scale/2, xMax=self.x[-1] + > x_scale/2, > yMin=self.y[0] - y_scale/2, yMax=self.y[-1] + > y_scale/2) > > self.imageItem.resetTransform() > self.imageItem.scale(x_scale, y_scale) > self.imageItem.setPos(self.x[0] - x_scale/2, self.y[0] - y_scale/2) > > Patrick > > On Friday, 24 May 2019 23:56:59 UTC+9:30, alxcpa 01101 wrote: >> >> I'm having trouble getting positive and negative Y values for a >> spectrogram. I can use img.scale(dt,df) to scale properly but I would >> actually like to scale and shift down by the half of the max frequency, >> like img.scale(dt, df (then - fmax/2)). I can't seem to find the source >> for .scale() or .setPos(), in ImageView it references the functions to >> ImageItem, but it is not in the ImageItem source. My only other idea is to >> create 2 images and scale one positive and one negative and combine them, >> but this doesn't seem necessary. Any ideas? >> >
-- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/e19a897f-9512-4ead-b517-07b72c14fdef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
