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
Added sphinx documentation for Triangulation #1494
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,5 +40,6 @@ | |
spines_api.rst | ||
ticker_api.rst | ||
tight_layout_api.rst | ||
tri_api.rst | ||
units_api.rst | ||
widgets_api.rst |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
**************** | ||
triangular grids | ||
**************** | ||
|
||
:mod:`matplotlib.tri` | ||
===================== | ||
|
||
.. automodule:: matplotlib.tri | ||
:members: Triangulation | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,27 +37,6 @@ class Triangulation(object): | |
triangles[i,(j+1)%3]. | ||
""" | ||
def __init__(self, x, y, triangles=None, mask=None): | ||
""" | ||
Create a Triangulation object. | ||
|
||
The first two arguments must be: | ||
|
||
*x*, *y*: arrays of shape (npoints). | ||
Point coordinates. | ||
|
||
Optional arguments (args or keyword args): | ||
|
||
*triangles*: integer array of shape (ntri,3). | ||
For each triangle, the indices of the three points that make | ||
up the triangle. If the points are ordered in a clockwise | ||
manner, they are converted to anticlockwise. | ||
|
||
If not specified, matplotlib.delaunay is used to create a | ||
Delaunay triangulation of the points. | ||
|
||
*mask*: optional boolean array of shape (ntri). | ||
Which triangles are masked out. | ||
""" | ||
self.x = np.asarray(x, dtype=np.float64) | ||
self.y = np.asarray(y, dtype=np.float64) | ||
if self.x.shape != self.y.shape or len(self.x.shape) != 1: | ||
|
@@ -106,10 +85,8 @@ def edges(self): | |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note I have changed this function's docstring to a comment as I don't want the function appearing in the sphinx documentation. The function should really be private with a leading underscore, but as this is a documentation PR I didn't want to change any code that would require new testing. I have made a note to address this when I am next altering the class. |
||
# if necessary. | ||
if self._cpp_triangulation is None: | ||
self._cpp_triangulation = _tri.Triangulation( | ||
self.x, self.y, self.triangles, self.mask, self._edges, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems quite a useful docstring? Is it out of date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is still valid. I discovered that sphinx chains together the class and constructor docstrings under the constructor heading. If they are sufficiently different we get away with it (as in the Path class at http://matplotlib.org/api/path_api.html - the constructor docstring begins after the Note), but in this case everything in the constructor docstring is already in the class docstring causing unnecessarily duplication. I thought the best solution was to remove the constructor docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot.