For external access to the lut, i.e. for displaying the cmap. For circular colormaps this returns a lut with a circular mask. Internal functions (such as to_rgb()) should use _lut which stores the lut without a circular mask A lut without the circular mask i
(self)
| 1827 | |
| 1828 | @property |
| 1829 | def lut(self): |
| 1830 | """ |
| 1831 | For external access to the lut, i.e. for displaying the cmap. |
| 1832 | For circular colormaps this returns a lut with a circular mask. |
| 1833 | |
| 1834 | Internal functions (such as to_rgb()) should use _lut |
| 1835 | which stores the lut without a circular mask |
| 1836 | A lut without the circular mask is needed in to_rgb() because the |
| 1837 | conversion from floats to ints results in some some pixel-requests |
| 1838 | just outside of the circular mask |
| 1839 | |
| 1840 | """ |
| 1841 | if not self._isinit: |
| 1842 | self._init() |
| 1843 | lut = np.copy(self._lut) |
| 1844 | if self.shape == 'circle' or self.shape == 'circleignore': |
| 1845 | n = np.linspace(-1, 1, self.N) |
| 1846 | m = np.linspace(-1, 1, self.M) |
| 1847 | radii_sqr = (n**2)[:, np.newaxis] + (m**2)[np.newaxis, :] |
| 1848 | mask_outside = radii_sqr > 1 |
| 1849 | lut[mask_outside, 3] = 0 |
| 1850 | return lut |
| 1851 | |
| 1852 | def __copy__(self): |
| 1853 | cls = self.__class__ |