Python Forum
Plotting level curves (isocurves) with pyqtgraph - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Plotting level curves (isocurves) with pyqtgraph (/thread-193.html)



Plotting level curves (isocurves) with pyqtgraph - alexfrigo - Sep-29-2016

Hi everyone,

I am trying to plot a red loop (isocurve) that correspond to the level z=2 of a given surface. Maybe I am able to create the isocurve, but I cannot overlap it to the grayscale image. (Output image)
I have been trying for days, but wasn't able to find any working example on the internet (isocurve.py included).
Can anybody provide me a working piece of code?

Thank you very much.

Here's the code.

from pyqtgraph.Qt import QtGui,QtCore
import numpy as np
import pyqtgraph as pg
import sys

app=QtGui.QApplication([])
x=np.linspace(0,6.28,30)
y=x[:]
xx,yy=np.meshgrid(x,y)
z=np.sin(xx)+np.cos(yy)

window=pg.GraphicsWindow()
window.setWindowTitle('isocurve example')
vb=window.addViewBox()
img=pg.ImageItem(z)
vb.addItem(img)
vb.setAspectLocked()

c=pg.IsocurveItem(level=2,pen='b')
c.setParentItem(img)
c.setZValue(0.5)
vb.addItem©


window.show()
sys.exit(app.exec_())


I forgot to say that I am forced to use the library pyqtgraph.
matplotlib solutions are not allowed.


RE: Plotting level curves (isocurves) with pyqtgraph - micseydel - Oct-03-2016

Since this is relatively specialized, you might want to try a more specialized community. If you do find the answer though, we'd definitely be curious about the solution!


RE: Plotting level curves (isocurves) with pyqtgraph - alexfrigo - Oct-03-2016

[SOLVED] here: http://stackoverflow.com/questions/39792905/level-curves-with-pyqtgraph-isocurve