Posts

Showing posts with the label pyqtgraph

How can I align an pyqtgraph IsocurveItem instance to empty plot axes (rather than an ImageItem)?

Image
How can I align an pyqtgraph IsocurveItem instance to empty plot axes (rather than an ImageItem)? The Problem The pyqtgraph documentation for IsocurveItem helpfully suggests that contours drawn with this class can be aligned to an ImageItem instance by isocurve.setParentItem(image) . But if I don't want to show image data, how can I scale the contour output to properly align with the axes given X,Y data? ImageItem isocurve.setParentItem(image) Example setup Using this code sample to draw: from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg import sys # Setup app = QtGui.QApplication() pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') win = pg.PlotWidget() layout = pg.GraphicsLayout() win.setCentralItem(layout) ax = pg.PlotItem() layout.addItem(ax) # Generate data x = np.linspace(0, 6.28, 30) y = x[:] xx, yy = np.meshgrid(x, y) z = np.sin(xx) + np.cos(yy) # Add data ax.setXRange(x.min(), x.max())...