How To Get The Pixel Coordinates Of A Plot Line In Pyqtgraph
I am drawing a plot with pyqtgraph: wave = pg.PlotWidget(self, QtGui.QColor(0, 0, 0, 0)) wave.plot([1,2,3], [1,2,1], pen=(0,0,255), fillLevel=-0, brush=(255,215,0)) I'd like to ge
Solution 1:
Qt makes it simple to map between coordinate systems with its QGraphicsItem.map*
methods. PyQtGraph further extends these with even more pg.GraphicsItem.map*
methods. The one you want works like this:
>>> import pyqtgraph as pg
>>> plt = pg.plot()
>>> wave = plt.plot([1,2,3], [1,2,1])
>>> wave.mapToDevice(pg.Point(3, 1))
PyQt4.QtCore.QPointF(615.6409081308565, 438.7833653023292)`
Post a Comment for "How To Get The Pixel Coordinates Of A Plot Line In Pyqtgraph"