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

Method _autolev

lib/matplotlib/contour.py:1002–1034  ·  view source on GitHub ↗

Select contour levels to span the data. We need two more levels for filled contours than for line contours, because for the latter we need to specify the lower and upper boundary of each range. For example, a single contour boundary, say at z = 0, requires o

(self)

Source from the content-addressed store, hash-verified

1000 self.locator = ticker.MaxNLocator(N + 1, min_n_ticks=1)
1001
1002 def _autolev(self):
1003 """
1004 Select contour levels to span the data.
1005
1006 We need two more levels for filled contours than for
1007 line contours, because for the latter we need to specify
1008 the lower and upper boundary of each range. For example,
1009 a single contour boundary, say at z = 0, requires only
1010 one contour line, but two filled regions, and therefore
1011 three levels to provide boundaries for both regions.
1012 """
1013 lev = self.locator.tick_values(self.zmin, self.zmax)
1014
1015 try:
1016 if self.locator._symmetric:
1017 return lev
1018 except AttributeError:
1019 pass
1020
1021 # Trim excess levels the locator may have supplied.
1022 under = np.nonzero(lev < self.zmin)[0]
1023 i0 = under[-1] if len(under) else 0
1024 over = np.nonzero(lev > self.zmax)[0]
1025 i1 = over[0] + 1 if len(over) else len(lev)
1026 if self.extend in ('min', 'both'):
1027 i0 += 1
1028 if self.extend in ('max', 'both'):
1029 i1 -= 1
1030
1031 if i1 - i0 < 3:
1032 i0, i1 = 0, len(lev)
1033
1034 return lev[i0:i1]
1035
1036 def _process_contour_level_args(self, args, z_dtype):
1037 """

Callers 1

Calls 1

tick_valuesMethod · 0.45

Tested by

no test coverage detected