Hi Alex, PyQtGraph uses multiple coordinate systems, the view coordinates (used in the ViewBox), the scene coordinate systems (mostly used in the GraphicsScene), the global coordinate system... it can get confusing fast! Generally speaking, if you want the values that are being plotted, you want to use the .getData() method as Patrick said (oddly enough, it's not in the documentation, huh, should probably change that).
If you want the values being plotted, you can go one level further and access the QPainterPath <https://doc-snapshots.qt.io/qt6-dev/qpainterpath.html> objects (in the case of line plots) by calling .getPath() and you can use various methods there. I wouldn't interact with the QPainterPath object unless there was something very specific you were looking for. I'm not sure what would happen if you plotted a line, applied a QTransform() to it, and then called .getData(). If you could share an example with what values you were looking for, and the code to set it up, I can take a look. Generally speaking, when trying to create simple examples, I recommend people start working from one of the examples. Ogi On Thu, Jun 24, 2021 at 7:38 PM Patrick <[email protected]> wrote: > Hi, > > The "missing" piece is to remember that pyqtgraph leans heavily on the Qt > GraphicsView > framework <https://doc.qt.io/qt-5/graphicsview.html>. The scale, > translations, rotations of the raw data points are handled by the GraphicsItem > transforms <https://doc.qt.io/qt-5/qgraphicsitem.html#transformations>, > which are really just affine transforms performed by the rendering engine. > > You can fetch the raw data from, say, a PlotItem with getData(), but I > think you'd need to apply your own affine transforms to the coordinates > (you can retrieve the transform matrix with transform() > <https://doc.qt.io/qt-5/qgraphicsitem.html#transform>though). > > As an aside, I have recently profiled laser spots using OpenCV, visualised > with a pyqtgraph UI. It works quite well and can do it in realtime at > decent frame rates. It's part of a larger project which is still in early > stages of development, but the OpenCV parts might be work looking at, found > in the _do_fit() method of this file: > https://gitlab.com/ptapping/trspectrometer/-/blob/develop/trspectrometer/plugins/aligncam/alignmentpanel.py > > Patrick > On Friday, 25 June 2021 at 2:10:46 am UTC+9:30 [email protected] wrote: > >> Been using pyqtgraph for some time. Very happy and impressed. >> >> An important question I have had for some time is: >> >> Is it possible to get access the data held in the graphic objects? >> >> For example.. I can create a line item. I can plot and I can rotate it >> and translate it with pyqtgraph methods. >> If it translate it how do I know where the new end points are? The >> plotting engine must know otherwise it couldn't work. >> >> I understand it is a fast plotting library. But surely the underlying >> data would be of extreme value for analysis? >> >> I have just used the isolineItem to find the contour of a laser spot. The >> visual feedback is helpful. Though I don't know how to get the array of >> data to proceed with things like finding the center. >> >> I seem to be missing something here....? >> >> Cheers >> Alex > > -- > 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/4461c61a-c932-4b62-b842-aadb25a3d30en%40googlegroups.com > <https://groups.google.com/d/msgid/pyqtgraph/4461c61a-c932-4b62-b842-aadb25a3d30en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CA%2BnduTH2WoQ9fC7RUMT%2B_hsSwAKshzRao4sMLiHfT%2B7a1s9ePg%40mail.gmail.com.
