Skip to content

Commit 8d7e9f9

Browse files
authored
fix: update matplotlib cmap for deprecation (#215)
1 parent 27a8767 commit 8d7e9f9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

LoopStructural/utils/colours.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def random_colour(n: int = 1, cmap='tab20'):
1717
list
1818
List of colours in the form of (r,g,b,a) tuples
1919
"""
20-
import matplotlib.cm as cm
21-
20+
from matplotlib import colormaps as cm
2221
colours = []
2322
for _i in range(n):
2423
colours.append(cm.get_cmap(cmap)(rng.random()))
@@ -41,7 +40,7 @@ def random_hex_colour(n: int = 1, cmap='tab20'):
4140
list
4241
List of colours in the form of hex strings
4342
"""
44-
import matplotlib.cm as cm
43+
from matplotlib import colormaps as cm
4544

4645
colours = []
4746
for _i in range(n):

0 commit comments

Comments
 (0)