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

Method _set_cmap

lib/matplotlib/colorizer.py:214–230  ·  view source on GitHub ↗

Set the colormap for luminance data. Parameters ---------- cmap : `.Colormap` or str or None

(self, cmap)

Source from the content-addressed store, hash-verified

212 self.norm.autoscale_None(A)
213
214 def _set_cmap(self, cmap):
215 """
216 Set the colormap for luminance data.
217
218 Parameters
219 ----------
220 cmap : `.Colormap` or str or None
221 """
222 in_init = self._cmap is None
223 cmap_obj = _ensure_cmap(cmap, accept_multivariate=True)
224 if not in_init and self.norm.n_components != cmap_obj.n_variates:
225 raise ValueError(f"The colormap {cmap} does not support "
226 f"{self.norm.n_components} variates as required by "
227 f"the {type(self.norm)} on this Colorizer")
228 self._cmap = cmap_obj
229 if not in_init:
230 self.changed() # Things are not set up properly yet.
231
232 @property
233 def cmap(self):

Callers 2

__init__Method · 0.95
cmapMethod · 0.95

Calls 2

changedMethod · 0.95
_ensure_cmapFunction · 0.85

Tested by

no test coverage detected