color [Data Science in Python: Names and Lists of Colors Specifiable in matplotlib] (https://pythondatascience.plavox.info/matplotlib/%E8%89%B2%E3%81%AE%E5%90%8D%E5%89%8D)
cmap [beiz note: A list of matplotlib cmap (colormap) parameters. ] (https://beiznotes.org/matplot-cmap-list/)
--Specify by character string:'# ????????', RGBA order by 2 digits from the top. For transparency, the last two digits are 00. --Specified by tuple: (R, G, B, A), each value is 0-1. Transparency is 0.0
By the way, the state of being completely transparent and invisible is called "transparency 0%".
The list is below.
[Primary Color Dictionary] (https://www.colordic.org/) [Qiita @ konifar: ARGB color code transparency summary] (https://qiita.com/konifar/items/106731d8a35303606597)
reference: [Python by Examples: Transparent colors] (http://python.omics.wiki/plot/matplotlib/transparent)
Example:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0.0, 15.0, 0.1)
y = np.sin(x)
plt.plot(y , color='#ff4500' ) # orangered
plt.plot(y - 1.0, color='#4169e1' ) # royalblue
plt.plot(y - 2.0, color='#4169e199') #royalblue, transparency 60%
plt.plot(y - 3.0, color='#4169e133') #royalblue, transparency 20%
plt.plot(y - 4.0, color='#4169e100') #royalblue, transparency 0%So i can't see
from matplotlib import colors
cmap = colors.ListedColormap(['white', 'red'])
bounds=[0,5,10]
norm = colors.BoundaryNorm(bounds, cmap.N)
img = plt.imshow(zvals, interpolation='nearest',
cmap=cmap, norm=norm)
plt.colorbar(img, cmap=cmap, norm=norm, boundaries=bounds, ticks=[0, 5, 10])
https://stackoverflow.com/questions/9707676/defining-a-discrete-colormap-for-imshow-in-matplotlib
For example, when drawing multiple line graphs.
cmap = plt.get_cmap("Blues")
for i in xrange(len(y)):
plt.plot(x, y[i], c=cmap(float(i)/N))
Qiita @ Tatejimaru137: Align the colors of the Matplotlib graph with similar colors (color map)
Qiita @ aisha: [Python] Adjust color map standards
Recommended Posts