added __invert__ method to reverse colormap

This commit is contained in:
Philip Eisenlohr 2020-07-02 10:13:47 -04:00
parent b88becb9d0
commit 3b72d0ec72
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ class Colormap(mpl.colors.ListedColormap):
return Colormap(np.vstack((self.colors,other.colors)), return Colormap(np.vstack((self.colors,other.colors)),
f'{self.name}+{other.name}') f'{self.name}+{other.name}')
def __invert__(self):
"""Return inverted colormap."""
return self.reversed()
@staticmethod @staticmethod
def from_range(low,high,name='DAMASK colormap',N=256,model='rgb'): def from_range(low,high,name='DAMASK colormap',N=256,model='rgb'):
""" """