simplified
This commit is contained in:
parent
6bd23715b8
commit
7c72bd48fb
|
@ -65,9 +65,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
def __mul__(self, factor: int) -> 'Colormap':
|
def __mul__(self, factor: int) -> 'Colormap':
|
||||||
"""Repeat."""
|
"""Repeat."""
|
||||||
return Colormap(np.broadcast_to(self.colors,(factor,)+self.colors.shape)
|
return Colormap(np.vstack([self.colors]*factor),f'{self.name}*{factor}')
|
||||||
.reshape((factor*self.colors.shape[0],)+self.colors.shape[1:]),
|
|
||||||
f'{self.name}*{factor}')
|
|
||||||
|
|
||||||
def __imul__(self, factor: int) -> 'Colormap':
|
def __imul__(self, factor: int) -> 'Colormap':
|
||||||
"""Repeat (in-place)."""
|
"""Repeat (in-place)."""
|
||||||
|
|
Loading…
Reference in New Issue