Skip to content

Commit 64bc250

Browse files
authored
Merge pull request #65 from Carreau/deprectaed-matplotlib-function-use
Remove usage of Matplotlib deprecated function.
2 parents 093d33f + e3bd13b commit 64bc250

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmocean/tools.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
Plot up stuff with colormaps.
33
'''
44

5+
import sys
6+
57
import numpy as np
68
import matplotlib as mpl
79

810

11+
if sys.version_info > (3,):
12+
_string_types = (str, np.str_, np.unicode_)
13+
else:
14+
_string_types = (basestring, np.str_, np.unicode_)
15+
16+
917
def print_colormaps(cmaps, N=256, returnrgb=True, savefiles=False):
1018
'''Print colormaps in 256 RGB colors to text files.
1119
@@ -73,7 +81,7 @@ def cmap(rgbin, N=256):
7381
'''
7482

7583
# rgb inputs here
76-
if not mpl.cbook.is_string_like(rgbin[0]):
84+
if not isinstance(rgbin[0], _string_types):
7785
# normalize to be out of 1 if out of 256 instead
7886
if rgbin.max() > 1:
7987
rgbin = rgbin/256.

0 commit comments

Comments
 (0)