今天又看到了這樣的代碼:
plt.imshow(X_train[0], cmap=plt.get_cmap('PuBuGn_r'))
#plt.imshow(X_train[0], cmap=plt.get_cmap('PuBuGn'))
然后發現 get_cmap 經常看到,但是不懂,查了一下,原來后面的就是個名稱,然后加 _r 表示反過來。
而名字的列表可以查這里:
https://matplotlib.org/users/colormaps.html
這個頁面也可以:
https://matplotlib.org/examples/color/colormaps_reference.html
比如這里: