From: alw46 [mailto:amandalaurelwebb@…287…]
Sent: Tuesday, January 24, 2012 3:40 PM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Plotting contour in X-Z plane
Hi Eric,
First, thanks for the sample - I agree that it's a neat example and I
really
appreciate the help.
Second, I've tried to adapt your code to my specific situation and I'm
running into a problem: it's not printing all the levels that I'm
specifying. Do you have any insights into why? I can't seem to find
any
documentation on the cntr.cntr method, so I'm just trial-and-erroring
it for
now.
Running the code you posted, I don't see any failures. The simplest way to check if is producing all of the contours that it should is to use the contour() function to plot the contours in each plane separately, and see that what it plots is identical to what contour3D() plots in each plane. When I do that, everything looks okay.
For instance, in the v[:,:,0] plane, the nominally missing contours are at 3, 3.1111, and 3.2222. However, if we ask if we should see these contours, by evaluating v[:,:,0].min() = 3.307, the answer is no, since they are all smaller than the minimum v in that plane. I haven't repeated this analysis for the other 9 planes, but I suspect it also follows there.
For reference, the Cntr object is defined by mpl as a C extension (code here: https://github.com/matplotlib/matplotlib/blob/master/src/cntr.c ). To display the small amount of help that it comes with call help(cntr.Cntr) in ipython. (Using cntr.Cntr? won't find the help.) I think that the entire cntr module is really an internal detail, hence the lack of user facing documentation.
I'd like it to print more than 6 contour levels (why did you have this
limit?), so I changed your error statement. I've also used a 10x10x10
grid,
and put in my own data for the 'v' set.
I limited it to 6 levels since my mesh was much denser and really with more than 1 or 2 levels there were too many lines to see anything useful. Rotating the view also becomes slow if the number of lines becomes excessively large.
Also, I've simplified it so that it's only displaying in the X-Y plane,
and
so that it's only displaying one "slice" in that plane. I'm asking it
to
display contours every 0.1, between 3.0 and 4.0, but some contours are
missing, and come up as empty arrays when I print 'c'.
FYI, your code does r_[3:4:10j] which gives 3.0 to 4.0 inclusive in steps of 1/9, rather than steps of 1/10, since when called this way r_ is endpoint inclusive.
I've uploaded the modified file.
http://old.nabble.com/file/p33197575/cntr3d_alw.py cntr3d_alw.py
Thanks!
Amanda
Best,
Eric
···
-----Original Message-----