We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 093d33f + e3bd13b commit 64bc250Copy full SHA for 64bc250
cmocean/tools.py
@@ -2,10 +2,18 @@
2
Plot up stuff with colormaps.
3
'''
4
5
+import sys
6
+
7
import numpy as np
8
import matplotlib as mpl
9
10
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
17
def print_colormaps(cmaps, N=256, returnrgb=True, savefiles=False):
18
'''Print colormaps in 256 RGB colors to text files.
19
@@ -73,7 +81,7 @@ def cmap(rgbin, N=256):
73
81
74
82
75
83
# rgb inputs here
76
- if not mpl.cbook.is_string_like(rgbin[0]):
84
+ if not isinstance(rgbin[0], _string_types):
77
85
# normalize to be out of 1 if out of 256 instead
78
86
if rgbin.max() > 1:
79
87
rgbin = rgbin/256.
0 commit comments