DOC: Lowercase some parameter names by timhoffm · Pull Request #23995 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 9 additions & 9 deletions lib/matplotlib/tests/test_triangulation.py
24 changes: 12 additions & 12 deletions lib/matplotlib/tri/tricontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def _contour_args(self, args, kwargs):

Call signatures::

%%(func)s(triangulation, Z, [levels], ...)
%%(func)s(x, y, Z, [levels], *, [triangles=triangles], [mask=mask], ...)
%%(func)s(triangulation, z, [levels], ...)
%%(func)s(x, y, z, [levels], *, [triangles=triangles], [mask=mask], ...)

The triangular grid can be specified either by passing a `.Triangulation`
object as the first parameter, or by passing the points *x*, *y* and
Expand All @@ -93,7 +93,7 @@ def _contour_args(self, args, kwargs):
*triangles* are given, the triangulation is calculated on the fly.

It is possible to pass *triangles* positionally, i.e.
``%%(func)s(x, y, triangles, Z, ...)``. However, this is discouraged. For more
``%%(func)s(x, y, triangles, z, ...)``. However, this is discouraged. For more
clarity, pass *triangles* via keyword argument.

Parameters
Expand All @@ -105,7 +105,7 @@ def _contour_args(self, args, kwargs):
Parameters defining the triangular grid. See `.Triangulation`.
This is mutually exclusive with specifying *triangulation*.

Z : array-like
z : array-like
The height values over which the contour is drawn. Color-mapping is
controlled by *cmap*, *norm*, *vmin*, and *vmax*.

Expand Down Expand Up @@ -157,20 +157,20 @@ def _contour_args(self, args, kwargs):
This parameter is ignored if *colors* is set.

origin : {*None*, 'upper', 'lower', 'image'}, default: None
Determines the orientation and exact position of *Z* by specifying the
position of ``Z[0, 0]``. This is only relevant, if *X*, *Y* are not given.
Determines the orientation and exact position of *z* by specifying the
position of ``z[0, 0]``. This is only relevant, if *X*, *Y* are not given.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about *X* etc here and below? I cannot say that I fully follow, but it is talked about x earlier.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interestingly, origin and extent are not used by tricontour[f] 😲. They are used in contour[f], where one can leave out X and Y, in which case origin and extent define where to place the data in the Axes. When one thinks about it, this concept does obviously does not apply to triangular grids. One always has to specify x and y, either directly or via a `Triangulation.

It's a bit hard to see that origin and extent are unused, because they are passed through multiple levels of kwargs and are added as attributes to ContourSet, which is the common base class of TriContourSet and QuadContourSet. But TriContourSet does not use them. One can also check this by removing the validation checks on these values and then passing in nonsense values: The plot does not care. It seems this docstring part was copied from contour[f] without thinking about it.

The origin and extent parameters will need to be removed. But that's a bit more complicated because even though unused we need to deprecate, and we have to figure out whether we can move them to QuadContourSet. I therefore propose to ignore their docstrings in this PR. They will be cleaned up in a separate PR. For simplicity, we can merge as proposed - it really does not matter and does not make sense what is in there either way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! What I meant though is that is seems like it should maybe be lower case x and y as well here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, my point was that this part of the docs doesn’t make sense either way and anyway will be removed soon. So it does not matter whether we change X and Y or not.


- *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
- 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
- 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
- *None*: ``z[0, 0]`` is at X=0, Y=0 in the lower left corner.
- 'lower': ``z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
- 'upper': ``z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
- 'image': Use the value from :rc:`image.origin`.

extent : (x0, x1, y0, y1), optional
If *origin* is not *None*, then *extent* is interpreted as in `.imshow`: it
gives the outer pixel boundaries. In this case, the position of Z[0, 0] is
gives the outer pixel boundaries. In this case, the position of z[0, 0] is
the center of the pixel, not a corner. If *origin* is *None*, then
(*x0*, *y0*) is the position of Z[0, 0], and (*x1*, *y1*) is the position
of Z[-1, -1].
(*x0*, *y0*) is the position of z[0, 0], and (*x1*, *y1*) is the position
of z[-1, -1].

This argument is ignored if *X* and *Y* are specified in the call to
contour.
Expand Down
42 changes: 21 additions & 21 deletions lib/matplotlib/tri/tripcolor.py