matplotlib of colors and cmaps

matplotlib 148 colors

matplotlib 160 in mapping colors

 

1, matplotlib in 148 colors

import matplotlib as plm
import matplotlib.pyplot as plt

colors = plm.colors.cnames.keys()

fig = plt.figure('百里希文', facecolor='lightyellow', edgecolor='k')
axes = fig.subplots(len(colors)//4, 4)

for c, ax in zip(colors, axes.ravel()):
    ax.hist(1, 3, color=c)
    ax.text(1.2, 0.1, c)
    ax.set_axis_off()
fig.subplots_adjust(left
=0, bottom=0, right=0.9, top=1, hspace=0.1, wspace=0.1)
fig.show()

 

2 matplotlib 160 in the color map

import numpy as npimport matplotlib as plm
import matplotlib.pyplot as plt

cmaps = plm.cm.cmap_d.keys()
gradient = np.linspace(0, 1, 256)
gradient = np.vstack((gradient, gradient))  

fig = plt.figure('百里希文', facecolor='lightyellow', edgecolor='k')
axes = fig.subplots(len(cmaps)//5, 5)

for cmap, ax in zip(cmaps, axes.ravel()):
    ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(cmap))
    ax.text(100, 1, cmap, fontsize=14)
    ax.set_axis_off()
    
fig.subplots_adjust(left=0.1, bottom=0, right=0.9,
                    top=1, hspace=0.1, wspace=0.1)    
fig.show()

 

按语:

推荐几篇文章

https://cloud.tencent.com/developer/ask/136207/answer/241390

https://blog.csdn.net/Mr_Cat123/article/details/78638491

https://www.cnblogs.com/charliedaifu/p/9957822.html

https://blog.csdn.net/zhaogeng111/article/details/78419015

Guess you like

Origin www.cnblogs.com/shanger/p/12040545.html