<div dir="ltr"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 January 2017 at 06:50, Eric Firing <span dir="ltr"><<a href="mailto:efiring@hawaii.edu" target="_blank">efiring@hawaii.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Sameer,<br>
<br>
They are fundamentally different in what they do; this is most clear if you experiment with using both methods on a low-resolution field (say 10 by 12 points), and with a small number of contours (5 or 10). Contouring is most typically done with a moderate number of contours, maybe 30 or fewer.  It is most immediately appropriate for data values at discrete points, since it is interpolating.  pcolormesh does not interpolate, but shows the value in each quadrilateral as a block of solid color, so it is more like an image.<br>
<br>
There are data sets and situations for which either of the two methods can be appropriate, and other cases where one is clearly better than the other.  For a somewhat noisy field, pcolormesh is usually better; it allows one to see the signal and the noise, and let one's eye pick out the former.  Isolated extreme values are represented better with pcolormesh.  For smoother fields and for seeing large-scale structure, contourf may be more appropriate.<br>
<br>
What kind of data are you plotting?<br>
<br>
Eric<div><div class="gmail-h5"><br>
<br>
<br>
On 2017/01/05 2:40 PM, Sameer Grover wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
Hello,<br>
<br>
I'd like to know about the difference between contourf and pcolormesh<br>
and their intended uses. So far, I've been using contourf with a large<br>
number of levels (150 - 200) to plot two dimensional data. Are their any<br>
disadvantages of this and is pcolormesh better suited for this task?<br>
<br>
As far as I can make out, contourf displays a "smoothened-out" image and<br>
pcolormesh is more "boxy".<br>
<br>
Thanks.<br>
<br>
Sameer<br>
<br>
<br>
<br></div></div>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/matplotlib-users</a><br>
<br>
</blockquote>
<br>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/matplotlib-users</a><br>
</blockquote></div><br><br clear="all"><div>Hi Eric,<br><br>The data is usually around 1000 X 1000 large or 
smaller, mainly experimental or theoretical data obtained by varying two
 independent parameters. With a large number of contours, the visual 
output from them doesn't look too different, especially if pcolormesh is
 used with gouraud shading. But I realize they do things differently.  
Thank you for the clarification.<br><br>My only comment is that 
contourf(x,y,z) expects z of shape(size(y), size(x)) whereas pcolormesh 
(x,y,z) expects z of shape (size(y)+1, size(x)+1), for obvious reasons.<br></div><div><br>It
 would be nice if pcolormesh could adjust x and y so that the centres of
 each quadrilateral is at the value of x and y, so that both functions 
could be called in the same way. <br><br>It's not hard to do but something that could be considered if there are enough use cases.<br></div><div><br></div><div>Sameer<br></div><br></div></div>