MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _contour_args

Method _contour_args

lib/matplotlib/tri/_tricontour.py:53–79  ·  view source on GitHub ↗
(self, args, kwargs)

Source from the content-addressed store, hash-verified

51 return kwargs
52
53 def _contour_args(self, args, kwargs):
54 tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args,
55 **kwargs)
56 z, *args = args
57 z = np.ma.asarray(z)
58 if z.shape != tri.x.shape:
59 raise ValueError('z array must have same length as triangulation x'
60 ' and y arrays')
61
62 # z values must be finite, only need to check points that are included
63 # in the triangulation.
64 z_check = z[np.unique(tri.get_masked_triangles())]
65 if np.ma.is_masked(z_check):
66 raise ValueError('z must not contain masked points within the '
67 'triangulation')
68 if not np.isfinite(z_check).all():
69 raise ValueError('z array must not contain non-finite values '
70 'within the triangulation')
71
72 z = np.ma.masked_invalid(z, copy=False)
73 self.zmax = float(z_check.max())
74 self.zmin = float(z_check.min())
75 if self.logscale and self.zmin <= 0:
76 func = 'contourf' if self.filled else 'contour'
77 raise ValueError(f'Cannot {func} log of negative values.')
78 self._process_contour_level_args(args, z.dtype)
79 return (tri, z)
80
81
82_docstring.interpd.register(_tricontour_doc="""

Callers 1

_process_argsMethod · 0.95

Calls 5

get_masked_trianglesMethod · 0.80
maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected