Hi,
# Set up the plot and add the ImageItemself.plot = self.plot_graphicsLayoutWidget.addPlot()self.plot.showGrid(x=True, y=True)self.plot.setLabels(bottom="Wavelength (nm)")self.image = pg.ImageItem(np.zeros((1, 1)))self.plot.addItem(self.image)#...# Acquire image from somewhere and set the ImageItem to use itself.image.setImage(image)# x-axis coordinate values are wavelengths (eg, 450--750)# y-axis coordinates are simply the camera pixel numbers (0--199)self.xlabels = np.arange(450, 750)# Translate and scale the ImageItem to match the x-axis labelsself.image.translate(self.xlabels[0], 0)self.image.scale((self.xlabels[-1] - self.xlabels[0])/len(self.xlabels), 1)--
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 pyqtgraph+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/96aa41d8-a1cd-45dd-ba55-c58e8eba265d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can use `PlotItem.invertY(False)` to set the direction of the y axis.You might also need to use the `axes` argument to `ImageView.setImage()`, depending on the order of axes in your image data.
On Wed, May 2, 2018 at 1:53 PM, S Martin <smar...@gmail.com> wrote:
Hello,I am trying to use ImageView to display an image but with axis included and specified y range. Basically I'm doing something like this:plt = pg.PlotItem(labels={'bottom':('time',''),'left':('frequency','')})imv = pg.ImageView(view=plt)x0, x1 = (0, 500)y0, y1 = (0, 16)xscale = (x1-x0)/img.shape[0]yscale = (y1-y0)/img.shape[1]imv.setImage(img, pos=[x0,y0], scale=[xscale, yscale])plt.setAspectLocked(False)Now the xaxis runs 0 to 500 left to right, but the yaxis runs 0 to 16 top to bottom. However, I want the yaxis to start at the bottom at 0 and run to 16 at the top (a usual increasing y axis). I am not sure how to set the axis range within ImageView.Thanks,Steve
--
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 pyqtgraph+...@googlegroups.com.