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

Method with_extremes

lib/matplotlib/colors.py:1974–2023  ·  view source on GitHub ↗

Return a copy of the `BivarColormap` with modified attributes. Note that the *outside* color is only relevant if `shape` = 'ignore' or 'circleignore'. Parameters ---------- bad : :mpltype:`color`, optional If given, the *bad* value is se

(self, *, bad=None, outside=None, shape=None, origin=None)

Source from the content-addressed store, hash-verified

1972 return self.resampled((None, None), transposed=True)
1973
1974 def with_extremes(self, *, bad=None, outside=None, shape=None, origin=None):
1975 """
1976 Return a copy of the `BivarColormap` with modified attributes.
1977
1978 Note that the *outside* color is only relevant if `shape` = 'ignore'
1979 or 'circleignore'.
1980
1981 Parameters
1982 ----------
1983 bad : :mpltype:`color`, optional
1984 If given, the *bad* value is set accordingly in the copy.
1985
1986 outside : :mpltype:`color`, optional
1987 If given and shape is 'ignore' or 'circleignore', values
1988 *outside* the colormap are colored accordingly in the copy.
1989
1990 shape : {'square', 'circle', 'ignore', 'circleignore'}
1991
1992 - If 'square' each variate is clipped to [0,1] independently
1993 - If 'circle' the variates are clipped radially to the center
1994 of the colormap, and a circular mask is applied when the colormap
1995 is displayed
1996 - If 'ignore' the variates are not clipped, but instead assigned the
1997 *outside* color
1998 - If 'circleignore' a circular mask is applied, but the data is not
1999 clipped and instead assigned the *outside* color
2000
2001 origin : (float, float)
2002 The relative origin of the colormap. Typically (0, 0), for colormaps
2003 that are linear on both axis, and (.5, .5) for circular colormaps.
2004 Used when getting 1D colormaps from 2D colormaps.
2005
2006 Returns
2007 -------
2008 BivarColormap
2009 copy of self with attributes set
2010 """
2011 new_cm = self.copy()
2012 if bad is not None:
2013 new_cm._rgba_bad = to_rgba(bad)
2014 if outside is not None:
2015 new_cm._rgba_outside = to_rgba(outside)
2016 if shape is not None:
2017 _api.check_in_list(['square', 'circle', 'ignore', 'circleignore'],
2018 shape=shape)
2019 new_cm._shape = shape
2020 if origin is not None:
2021 new_cm._origin = (float(origin[0]), float(origin[1]))
2022
2023 return new_cm
2024
2025 def _init(self):
2026 """Generate the lookup table, ``self._lut``."""

Callers

nothing calls this directly

Calls 2

copyMethod · 0.95
to_rgbaFunction · 0.85

Tested by

no test coverage detected