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

Method _process_args

lib/matplotlib/contour.py:894–936  ·  view source on GitHub ↗

Process *args* and *kwargs*; override in derived classes. Must set self.levels, self.zmin and self.zmax, and update Axes limits.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

892 return artists, labels
893
894 def _process_args(self, *args, **kwargs):
895 """
896 Process *args* and *kwargs*; override in derived classes.
897
898 Must set self.levels, self.zmin and self.zmax, and update Axes limits.
899 """
900 self.levels = args[0]
901 allsegs = args[1]
902 allkinds = args[2] if len(args) > 2 else None
903 self.zmax = np.max(self.levels)
904 self.zmin = np.min(self.levels)
905
906 if allkinds is None:
907 allkinds = [[None] * len(segs) for segs in allsegs]
908
909 # Check lengths of levels and allsegs.
910 if self.filled:
911 if len(allsegs) != len(self.levels) - 1:
912 raise ValueError('must be one less number of segments as '
913 'levels')
914 else:
915 if len(allsegs) != len(self.levels):
916 raise ValueError('must be same number of segments as levels')
917
918 # Check length of allkinds.
919 if len(allkinds) != len(allsegs):
920 raise ValueError('allkinds has different length to allsegs')
921
922 # Determine x, y bounds and update axes data limits.
923 flatseglist = [s for seg in allsegs for s in seg]
924 points = np.concatenate(flatseglist, axis=0)
925 self._mins = points.min(axis=0)
926 self._maxs = points.max(axis=0)
927
928 # Each entry in (allsegs, allkinds) is a list of (segs, kinds): segs is a list
929 # of (N, 2) arrays of xy coordinates, kinds is a list of arrays of corresponding
930 # pathcodes. However, kinds can also be None; in which case all paths in that
931 # list are codeless (this case is normalized above). These lists are used to
932 # construct paths, which then get concatenated.
933 self._paths = [Path.make_compound_path(*map(Path, segs, kinds))
934 for segs, kinds in zip(allsegs, allkinds)]
935
936 return kwargs
937
938 def _make_paths_from_contour_generator(self):
939 """Compute ``paths`` using C extension."""

Callers 1

__init__Method · 0.95

Calls 3

maxMethod · 0.80
minMethod · 0.80
make_compound_pathMethod · 0.80

Tested by

no test coverage detected