Skip to content

Some doc cleanup of Triangulation #11585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions lib/matplotlib/tri/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ class Triangulation(object):

Parameters
----------
x, y : array_like of shape (npoints)
x, y : array-like of shape (npoints)
Coordinates of grid points.
triangles : integer array_like of shape (ntri, 3), optional
For each triangle, the indices of the three points that make
up the triangle, ordered in an anticlockwise manner. If not
specified, the Delaunay triangulation is calculated.
mask : boolean array_like of shape (ntri), optional
mask : boolean array-like of shape (ntri), optional
Which triangles are masked out.

Attributes
----------
`edges`
`neighbors`
edges : int array of shape (nedges, 2)
See `~.Triangulation.edges`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is throwing an error for me when building the docs locally.

d:\...\matplotlib\lib\matplotlib\tri\triangulation.py:docstring of matplotlib.tri.Triangulation:40: toctree references unknown document 'api/matplotlib.tri.Triangulation.edges'

I wonder anyways why

   edges : int array of shape (nedges, 2)
        See `~.Triangulation.edges`

translates into

image

see link to built doc

Is there some novel doc interpolation going on? Does this have any additional requirement?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not reproduce this locally.

Can you check for stale build products? What version of Matplotlib do you have installed (as the docs are built against the installed version).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The built documentation seems to be pulled from the docstring on the edges property below. The issues maybe different versions of numpydoc behaving differently...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks for the hint. I update the requirement in #11667

neighbors : int array of shape (ntri, 3)
See `~.Triangulation.neighbors`
mask : bool array of shape (ntri, 3)
Masked out triangles.
is_delaunay : bool
Whether the Triangulation is a calculated Delaunay
triangulation (where `triangles` was not specified) or not.
Expand Down Expand Up @@ -76,29 +80,32 @@ def __init__(self, x, y, triangles=None, mask=None):
def calculate_plane_coefficients(self, z):
"""
Calculate plane equation coefficients for all unmasked triangles from
the point (x,y) coordinates and specified z-array of shape (npoints).
Returned array has shape (npoints,3) and allows z-value at (x,y)
the point (x, y) coordinates and specified z-array of shape (npoints).
The returned array has shape (npoints, 3) and allows z-value at (x, y)
position in triangle tri to be calculated using
z = array[tri,0]*x + array[tri,1]*y + array[tri,2].
``z = array[tri, 0] * x + array[tri, 1] * y + array[tri, 2]``.
"""
return self.get_cpp_triangulation().calculate_plane_coefficients(z)

@property
def edges(self):
"""
Return integer array of shape (nedges,2) containing all edges of
Return integer array of shape (nedges, 2) containing all edges of
non-masked triangles.

Each edge is the start point index and end point index. Each
edge (start,end and end,start) appears only once.
Each row defines an edge by it's start point index and end point
index. Each edge appears only once, i.e. for an edge between points
*i* and *j*, there will only be either *(i, j)* or *(j, i)*.
"""
if self._edges is None:
self._edges = self.get_cpp_triangulation().get_edges()
return self._edges

def get_cpp_triangulation(self):
# Return the underlying C++ Triangulation object, creating it
# if necessary.
"""
Return the underlying C++ Triangulation object, creating it
if necessary.
"""
if self._cpp_triangulation is None:
self._cpp_triangulation = _tri.Triangulation(
self.x, self.y, self.triangles, self.mask, self._edges,
Expand Down Expand Up @@ -175,7 +182,7 @@ def get_trifinder(self):
@property
def neighbors(self):
"""
Return integer array of shape (ntri,3) containing neighbor
Return integer array of shape (ntri, 3) containing neighbor
triangles.

For each triangle, the indices of the three triangles that
Expand Down