Skip to content

Commit 39cfe2b

Browse files
committed
Warn when passing triangles or mask alongside a Triangulation
1 parent aef5bd6 commit 39cfe2b

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

lib/matplotlib/tri/triangulation.py

Lines 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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy