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

Method resampled

lib/matplotlib/colors.py:1578–1600  ·  view source on GitHub ↗

Return a new colormap with *lutshape* entries. Parameters ---------- lutshape : tuple of (`int`, `None`) The tuple must have a length matching the number of variates. For each element in the tuple, if `int`, the corresponding colorbar

(self, lutshape)

Source from the content-addressed store, hash-verified

1576 return np.array(self._rgba_bad)
1577
1578 def resampled(self, lutshape):
1579 """
1580 Return a new colormap with *lutshape* entries.
1581
1582 Parameters
1583 ----------
1584 lutshape : tuple of (`int`, `None`)
1585 The tuple must have a length matching the number of variates.
1586 For each element in the tuple, if `int`, the corresponding colorbar
1587 is resampled, if `None`, the corresponding colorbar is not resampled.
1588
1589 Returns
1590 -------
1591 MultivarColormap
1592 """
1593
1594 if not np.iterable(lutshape) or len(lutshape) != len(self):
1595 raise ValueError(f"lutshape must be of length {len(self)}")
1596 new_cmap = self.copy()
1597 for i, s in enumerate(lutshape):
1598 if s is not None:
1599 new_cmap._colormaps[i] = self[i].resampled(s)
1600 return new_cmap
1601
1602 def with_extremes(self, *, bad=None, under=None, over=None):
1603 """

Callers

nothing calls this directly

Calls 2

copyMethod · 0.95
resampledMethod · 0.45

Tested by

no test coverage detected