contourf: matplotlib.path.Path are LINETOs?

Hi all,

when drawing contourf plots, I inspected the underlying
matplotlib.path.Path elements that determine the curves and noticed
that they are all of code LINETO (see
http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
although the number of vertices is 6, actually suggesting a CURVE4.

Would that be a bug?

Cheers,
Nico

Hi all,

when drawing contourf plots, I inspected the underlying
matplotlib.path.Path elements that determine the curves and noticed
that they are all of code LINETO (see
http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
although the number of vertices is 6, actually suggesting a CURVE4.

Would that be a bug?

I don't see it.

x = np.arange(9)
x.shape = (3,3)
cs = contourf(x, 1)
print cs.collections.get_paths()

This shows a set of vertices with a matching set of LINETO (after an initial MOVETO). contour and contourf generate piece-wise linear paths with vertices on grid cell boundaries; they make no attempt to smooth out the contours.

Eric

···

On 12/13/2011 11:03 AM, Nico Schlömer wrote:

Cheers,
Nico

I don't see it.

You're right. -- I've looked at it again and I can confirm that the
outlines are drawn with LINETOs.

This shows a set of vertices with a matching set of LINETO (after an
initial MOVETO). contour and contourf generate piece-wise linear paths
with vertices on grid cell boundaries; they make no attempt to smooth
out the contours.

I looked at the example in
http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_log.html

and used the point information in the LINETOs to reproduce the figure.
It seems that, except for the blue patches in the corners, this
information is really rough. Take a peek at the file I attached; left:
matplotlib rendering, right: lines manually redrawn.

Do you know what's going on?

--Nico

···

On Tue, Dec 13, 2011 at 11:39 PM, Eric Firing <efiring@...202...> wrote:

On 12/13/2011 11:03 AM, Nico Schlömer wrote:

Hi all,

when drawing contourf plots, I inspected the underlying
matplotlib.path.Path elements that determine the curves and noticed
that they are all of code LINETO (see
http://matplotlib.sourceforge.net/api/path_api.html#matplotlib.path.Path)
although the number of vertices is 6, actually suggesting a CURVE4.

Would that be a bug?

I don't see it.

x = np.arange(9)
x.shape = (3,3)
cs = contourf(x, 1)
print cs.collections.get_paths()

This shows a set of vertices with a matching set of LINETO (after an
initial MOVETO). contour and contourf generate piece-wise linear paths
with vertices on grid cell boundaries; they make no attempt to smooth
out the contours.

Eric

Cheers,
Nico

------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options