simplified

This commit is contained in:
Martin Diehl 2022-01-24 15:07:47 +01:00
parent 6bd23715b8
commit 7c72bd48fb
1 changed files with 1 additions and 3 deletions

View File

@ -65,9 +65,7 @@ class Colormap(mpl.colors.ListedColormap):
def __mul__(self, factor: int) -> 'Colormap':
"""Repeat."""
return Colormap(np.broadcast_to(self.colors,(factor,)+self.colors.shape)
.reshape((factor*self.colors.shape[0],)+self.colors.shape[1:]),
f'{self.name}*{factor}')
return Colormap(np.vstack([self.colors]*factor),f'{self.name}*{factor}')
def __imul__(self, factor: int) -> 'Colormap':
"""Repeat (in-place)."""