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

Method _ensure_locator_exists

lib/matplotlib/contour.py:982–1000  ·  view source on GitHub ↗

Set a locator on this ContourSet if it's not already set. Parameters ---------- N : int or None If *N* is an int, it is used as the target number of levels. Otherwise when *N* is None, a reasonable default is chosen; for logscales

(self, N)

Source from the content-addressed store, hash-verified

980 super().changed()
981
982 def _ensure_locator_exists(self, N):
983 """
984 Set a locator on this ContourSet if it's not already set.
985
986 Parameters
987 ----------
988 N : int or None
989 If *N* is an int, it is used as the target number of levels.
990 Otherwise when *N* is None, a reasonable default is chosen;
991 for logscales the LogLocator chooses, N=7 is the default
992 otherwise.
993 """
994 if self.locator is None:
995 if self.logscale:
996 self.locator = ticker.LogLocator(numticks=N)
997 else:
998 if N is None:
999 N = 7 # Hard coded default
1000 self.locator = ticker.MaxNLocator(N + 1, min_n_ticks=1)
1001
1002 def _autolev(self):
1003 """

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected