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

Method _process_args

lib/matplotlib/contour.py:1318–1373  ·  view source on GitHub ↗

Process args and kwargs.

(self, *args, corner_mask=None, algorithm=None, **kwargs)

Source from the content-addressed store, hash-verified

1316 """
1317
1318 def _process_args(self, *args, corner_mask=None, algorithm=None, **kwargs):
1319 """
1320 Process args and kwargs.
1321 """
1322 if args and isinstance(args[0], QuadContourSet):
1323 if self.levels is None:
1324 self.levels = args[0].levels
1325 self.zmin = args[0].zmin
1326 self.zmax = args[0].zmax
1327 self._corner_mask = args[0]._corner_mask
1328 contour_generator = args[0]._contour_generator
1329 self._mins = args[0]._mins
1330 self._maxs = args[0]._maxs
1331 self._algorithm = args[0]._algorithm
1332 else:
1333 import contourpy
1334
1335 algorithm = mpl._val_or_rc(algorithm, 'contour.algorithm')
1336 mpl.rcParams.validate["contour.algorithm"](algorithm)
1337 self._algorithm = algorithm
1338
1339 if corner_mask is None:
1340 if self._algorithm == "mpl2005":
1341 # mpl2005 does not support corner_mask=True so if not
1342 # specifically requested then disable it.
1343 corner_mask = False
1344 else:
1345 corner_mask = mpl.rcParams['contour.corner_mask']
1346 self._corner_mask = corner_mask
1347
1348 x, y, z = self._contour_args(args, kwargs)
1349
1350 contour_generator = contourpy.contour_generator(
1351 x, y, z, name=self._algorithm, corner_mask=self._corner_mask,
1352 line_type=contourpy.LineType.SeparateCode,
1353 fill_type=contourpy.FillType.OuterCode,
1354 chunk_size=self.nchunk)
1355
1356 t = self.get_transform()
1357
1358 # if the transform is not trans data, and some part of it
1359 # contains transData, transform the xs and ys to data coordinates
1360 if (t != self.axes.transData and
1361 any(t.contains_branch_separately(self.axes.transData))):
1362 trans_to_data = t - self.axes.transData
1363 pts = np.vstack([x.flat, y.flat]).T
1364 transformed_pts = trans_to_data.transform(pts)
1365 x = transformed_pts[..., 0]
1366 y = transformed_pts[..., 1]
1367
1368 self._mins = [ma.min(x), ma.min(y)]
1369 self._maxs = [ma.max(x), ma.max(y)]
1370
1371 self._contour_generator = contour_generator
1372
1373 return kwargs
1374
1375 def _contour_args(self, args, kwargs):

Callers

nothing calls this directly

Calls 6

_contour_argsMethod · 0.95
minMethod · 0.80
maxMethod · 0.80
get_transformMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected