Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39cfe2b

Browse filesBrowse files
committed
Warn when passing triangles or mask alongside a Triangulation
1 parent aef5bd6 commit 39cfe2b
Copy full SHA for 39cfe2b

File tree

Expand file treeCollapse file tree

2 files changed

+29
-12
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+29
-12
lines changed

‎lib/matplotlib/tri/triangulation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/triangulation.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import numpy as np
22

3+
from matplotlib import _api
4+
35

46
class Triangulation:
57
"""
@@ -135,6 +137,14 @@ def get_from_args_and_kwargs(*args, **kwargs):
135137
"""
136138
if isinstance(args[0], Triangulation):
137139
triangulation, *args = args
140+
if 'triangles' in kwargs:
141+
_api.warn_external(
142+
"Passing the keyword 'triangles' has no effect when also "
143+
"passing a Triangulation")
144+
if 'mask' in kwargs:
145+
_api.warn_external(
146+
"Passing the keyword 'mask' has no effect when also "
147+
"passing a Triangulation")
138148
else:
139149
x, y, triangles, mask, args, kwargs = \
140150
Triangulation._extract_triangulation_params(args, kwargs)

‎lib/matplotlib/tri/tripcolor.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/tripcolor.py
+19-12Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
1111
"""
1212
Create a pseudocolor plot of an unstructured triangular grid.
1313
14-
The triangulation can be specified in one of two ways; either::
14+
Call signatures::
1515
16-
tripcolor(triangulation, ...)
16+
tripcolor(triangulation, C, *, ...)
17+
tripcolor(x, y, C, *, [triangles=triangles], [mask=mask], ...)
1718
18-
where triangulation is a `.Triangulation` object, or
19+
The triangular grid can be specified either by passing a `.Triangulation`
20+
object as the first parameter, or by passing the points *x*, *y* and
21+
optionally the *triangles* and a *mask*. See `.Triangulation` for an
22+
explanation of these parameters.
1923
20-
::
24+
Parameters
25+
----------
26+
triangulation : `.Triangulation`
27+
An already created triangular grid.
28+
x, y, triangles, mask
29+
Parameters specifying defining the triangular grid. See
30+
`.Triangulation`.
2131
22-
tripcolor(x, y, ...)
23-
tripcolor(x, y, triangles, ...)
24-
tripcolor(x, y, triangles=triangles, ...)
25-
tripcolor(x, y, mask=mask, ...)
26-
tripcolor(x, y, triangles, mask=mask, ...)
27-
28-
in which case a Triangulation object will be created. See `.Triangulation`
29-
for a explanation of these possibilities.
3032
3133
The next argument must be *C*, the array of color values, either
3234
one per point in the triangulation if color values are defined at
@@ -42,6 +44,11 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
4244
three points. If *shading* is 'gouraud' then color values must be
4345
defined at points.
4446
47+
48+
49+
tripcolor(x, y, [triangles], C, [mask=mask], ...)
50+
51+
4552
The remaining kwargs are the same as for `~.Axes.pcolor`.
4653
"""
4754
_api.check_in_list(['flat', 'gouraud'], shading=shading)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.