Strech image to window size in pyqtgraph

62 views
Skip to first unread message

rob.l...@gmail.com

unread,
Jun 26, 2015, 1:39:18 PM6/26/15
to pyqt...@googlegroups.com

I'm currently trying to create a PyQtGraph gui to plot an image repeatedly as new data comes in using code similar to this:


self.app = QtGui.QApplication([])
self.win = QtGui.QMainWindow()
self.win.resize(800, 600)
self.imv = pg.ImageView()
self.win.setCentralWidget(self.imv)
self.win.setWindowTitle('My Title')
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.check_for_new_data_and_replot)
self.timer.start(100) self.win.show()

then each time I get new data I draw the image:


self.imv.setImage(self.data_array)

One problem I'm running into is that my data array usually has a skewed aspect ratio, i.e. it is usually really "tall and skinny" or "short and fat", and the image that is plotted has the same proportions.


Is there a way to stretch the image to fit the window? I've looked through the documentation for ImageView and ImageItem, but can't find what I need. (Perhaps it is there, but I am having trouble identifying it.)

Reply all
Reply to author
Forward
Message has been deleted
0 new messages