SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Thomas R. <tho...@gm...> - 2009年01月30日 03:43:59
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
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /