added __eq__ and test
This commit is contained in:
parent
3e1a6dcab7
commit
3bf10127b8
|
@ -42,6 +42,11 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __eq__(self, other) -> bool:
|
||||||
|
"""Test equality of colormaps."""
|
||||||
|
return len(self.colors) == len(other.colors) \
|
||||||
|
and bool(np.all(self.colors == other.colors))
|
||||||
|
|
||||||
def __add__(self, other: "Colormap") -> "Colormap":
|
def __add__(self, other: "Colormap") -> "Colormap":
|
||||||
"""Concatenate."""
|
"""Concatenate."""
|
||||||
return Colormap(np.vstack((self.colors,other.colors)),
|
return Colormap(np.vstack((self.colors,other.colors)),
|
||||||
|
|
Loading…
Reference in New Issue