On 26 October 2014 00:18, Hartmut Kaiser <hartmut.kai...@gmail.com> wrote:

> At this point we assume, that polys[0] is a linear ring to be interpreted
> as
> a polygon exterior and polys[1:] are the corresponding interiors for
> polys[0].
>
> Here are our questions:
>
> Is this assumption correct?
> Is there any detailed documentation describing the structure of the
> returned
> geometries?
> Are the linear rings supposed to be correctly oriented (area > 0 for
> exteriors and area < 0 for the interiors)?
>

Hello Hartmut,

In brief, the answers are no, no and yes.

In more detail, assuming polys is not empty then it will contain one or
more polygon exteriors and zero or more interiors, and they can be in any
order.  Here is a simple example where polys[0] is an interior and polys[1]
an exterior:

    x = [0, 0, 1, 1, 0.5]
    y = [0, 1, 0, 1, 0.5]
    z = [0.5, 0.5, 0.5, 0.5, 0]
    triang = tri.Triangulation(x, y)
    contour = plt.tricontourf(triang, z, levels=[0.2, 0.4])

The returned geometries are purposefully not documented.  They are an
'implementation detail' and not considered part of the public interface.
and as such they could change at any time and hence should not be relied
upon.  Of course you can choose to access them if you wish, as I do myself
sometimes, but we make no promises about what the order of the polygons is,
or that it won't change tomorrow.

In reality the order of the polygons is chosen to be something that is easy
for both the contour generation routines to create and for the various
backends to render.  If you were to look at the output generated by
contourf, you will see that it is organised differently from that produced
by tricontourf and is more like you would like it to be, i.e. one or more
groups of an exterior polygon followed by zero or more interiors.  This is
historical as the contourf code dates from before all of the backends were
able to render arbitrary groups of exterior and interior polygons, and so
the contourf code has to calculate the order for the backends.  When the
tricontourf code was written the backends were all able to calculate the
exterior/interior containment themselves, so there was no need for
tricontourf to do it as well.

Ian
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to