代码如下:
方法一:
import matplotlib.pyplot as plt
cmaps = sorted(m for m in plt.cm.datad if not m.endswith("_r"))
print(cmaps)
我们忽略以_r
结尾的类型,因为它们都是类型后面不带有_r
的反转版本(reversed version)。
所有的类型我们可以在matplotlib的源代码中找到:(如下图)
方法二:
import matplotlib.pyplot as plt
cmap_list1 = plt.colormaps()
print(cmap_list1)