Hi all,
I am trying to do the following to produce a customized contour plot:
1. Create a ContourSet from contour()
2. Retrieve vertex positions from this ContourSet
3. Modify the vertex positions by applying a coordinate transformation
4. Apply the changes to the ContourSet
5. Plot the ContourSet
At the moment, I do:
c = contour(image)
then I can get the vertex positions with
for collection in contours.collections:
for polygon in collection.get_paths():
x = polygon.vertices[:,0]
y = polygon.vertices[:,1]
Then, I can apply mathematical operations to x and y, and replace
c.collections with a new set of LineCollections. So c now contains an
updated collections set.
My question is, how do I now plot these modified contours? I
intuitively tried show(c) and draw(c), but now luck. Since I am a
beginner at python, this may actually be obvious, but I can't figure
it out!
I also have a minor problem with:
c = contour(image)
as this will draw the contours straight away onto the image, but I
don't want this to be the case, as I only want to show the modified
contours. I am using 'ipython -pylab' to run python, so I am guessing
that this is something to do with the fact that ipython refreshes the
plot at each plotting command? Is there an easy fix to prevent that
in this case?
Thank you for any help!
Thomas
|