1. Overview
This article is a reference of all named colors in Pandas. It shows a list of more than 1200+ named colors in Python, Matplotlib and Pandas. They are based on the Python library Matplotlib.
The work in based on two articles:
- How to Get a List of N Different Colors and Names in Python/Pandas
- List of named colors - Matplotlib
We are going to build different color palettes and different conversion techniques.
The image below shows some of the colors:
2. Convert colors in Matplotlib, Python and Pandas
To learn more about the color conversion in Python you can check 5th step of the above article: Working with color names and color values
In this section we will cover the next conversions:
- RGB to HEX =
(0.0, 1.0, 1.0)
->#00FFFF
- HEX to RGB =
#00FFFF
->(0.0, 1.0, 1.0)
2.1. Convert RGB to HEX color in Python and Pandas
Let's start with conversion of RGB color in decimal code to HEX code. To do so we are going to use Matplotlib method: mcolors.rgb2hex()
:
import matplotlib.colors as mcolorsmcolors.rgb2hex((0.0, 1.0, 1.0))
result:
'#00ffff'
2.2. Convert RGB to HSL in Pandas
To convert from RGB to HSL in Pandas we are going to use method: rgb_to_hsv
:
mcolors.rgb_to_hsv((0, 0, 1))
the output is array of hue, saturation and lightness:
array([0.66666667, 1. , 1. ])
2.3. Convert HEX to RGB format in Python and Pandas
Similarly we can do the HEX to RGB conversion by using method - `mcolors.hex2color():
import matplotlib.colors as mcolorsmcolors.hex2color('#40E0D0')
result:
(0.25098039215686274, 0.8784313725490196, 0.8156862745098039)
The result has high decimal precision. If you like to reduce the decimal numbers we can use list comprehension:
[round(c, 5) for c in (0.25098039215686274, 0.8784313725490196, 0.8156862745098039)]
will give us:
[0.25098, 0.87843, 0.81569]
To apply to a column in Pandas DataFrame we can use a lambda expression:
df_colors['rgb'] = df_colors['rgb'].apply(lambda x:[round(c, 5) for c in x])
2.4. Convert RGB to HEX color for whole column in Pandas
We can also apply the conversion to a single or multiple columns in Pandas DataFrame. For this purpose we are going to use method apply()
:
df_colors['hex'] = df_colors['rgb'].apply(mcolors.rgb2hex)
The following example demonstrate this:
import pandas as pdcolors = { 'name': mcolors.BASE_COLORS.keys(), 'rgb': mcolors.BASE_COLORS.values() }df_colors = pd.DataFrame(colors)df_colors['hex'] = df_colors['rgb'].apply(mcolors.rgb2hex)
The result DataFrame with converted RGB column to HEX one:
name | rgb | hex | |
---|---|---|---|
0 | b | (0, 0, 1) | #0000ff |
1 | g | (0, 0.5, 0) | #008000 |
2 | r | (1, 0, 0) | #ff0000 |
3 | c | (0, 0.75, 0.75) | #00bfbf |
4 | m | (0.75, 0, 0.75) | #bf00bf |
3. BASE_COLORS: Named Colors in Pandas
We will start with the most basic colors with names from Matplotlib - mcolors.BASE_COLORS
.
Below you can find a table with the color name, RGB and HEX values plus display of the color:
We are going to use the next code to generate the values:
import pandas as pddef format_color_groups(df, color): x = df.copy() i = 0 for factor in color: x.iloc[i, :-1] = '' style = f'background-color: {color[i]}' x.loc[i, 'display color as background'] = style i = i + 1 return xcolors = { 'name': mcolors.BASE_COLORS.keys(), 'rgb': mcolors.BASE_COLORS.values() }df_colors = pd.DataFrame(colors)df_colors['hex'] = df_colors['rgb'].apply(mcolors.rgb2hex)df_colors['display color as background'] = ''df_colors.style.apply(format_color_groups, color=df_colors.hex, axis=None)
The list of the basic colors in Pandas is shown below:
name | rgb | hex | display color as background | |
---|---|---|---|---|
0 | b | (0, 0, 1) | #0000ff | |
1 | g | (0, 0.5, 0) | #008000 | |
2 | r | (1, 0, 0) | #ff0000 | |
3 | c | (0, 0.75, 0.75) | #00bfbf | |
4 | m | (0.75, 0, 0.75) | #bf00bf | |
5 | y | (0.75, 0.75, 0) | #bfbf00 | |
6 | k | (0, 0, 0) | #000000 | |
7 | w | (1, 1, 1) | #ffffff |
4. TABLEAU_COLORS: List of Named Colors in Python and Pandas
Next we will cover the list of TABLEAU_COLORS in Pandas. They are limited to the most popular colors only. The code below will list all of them:
import pandas as pddef format_color_groups(df, color): x = df.copy() i = 0 for factor in color: x.iloc[i, :-1] = '' style = f'background-color: {color[i]}' x.loc[i, 'display color as background'] = style i = i + 1 return xcolors = { 'name': mcolors.TABLEAU_COLORS.keys(), 'hex': mcolors.TABLEAU_COLORS.values() }df_colors = pd.DataFrame(colors)df_colors['rgb'] = df_colors['hex'].apply(mcolors.hex2color)df_colors['rgb'] = df_colors['rgb'].apply(lambda x:[round(c, 5) for c in x])df_colors['display color as background'] = ''df_colors.style.apply(format_color_groups, color=df_colors.hex, axis=None)
And the table is:
name | hex | rgb | display color as background | |
---|---|---|---|---|
0 | tab:blue | #1f77b4 | [0.12157, 0.46667, 0.70588] | |
1 | tab:orange | #ff7f0e | [1.0, 0.49804, 0.0549] | |
2 | tab:green | #2ca02c | [0.17255, 0.62745, 0.17255] | |
3 | tab:red | #d62728 | [0.83922, 0.15294, 0.15686] | |
4 | tab:purple | #9467bd | [0.58039, 0.40392, 0.74118] | |
5 | tab:brown | #8c564b | [0.54902, 0.33725, 0.29412] | |
6 | tab:pink | #e377c2 | [0.8902, 0.46667, 0.76078] | |
7 | tab:gray | #7f7f7f | [0.49804, 0.49804, 0.49804] | |
8 | tab:olive | #bcbd22 | [0.73725, 0.74118, 0.13333] | |
9 | tab:cyan | #17becf | [0.0902, 0.7451, 0.81176] |
5. CSS4_COLORS colors in Python and Pandas
The CSS4_COLORS contains many different named colors which can be used in Python and Matplotlib. We can list all of them by:
def format_color_groups(df, color): x = df.copy() i = 0 for factor in color: x.iloc[i, :-1] = '' style = f'background-color: {color[i]}' x.loc[i, 'display color as background'] = style i = i + 1 return xcolors = { 'name': mcolors.CSS4_COLORS.keys(), 'hex': mcolors.CSS4_COLORS.values() }df_colors = pd.DataFrame(colors)df_colors['rgb'] = df_colors['hex'].apply(mcolors.hex2color)df_colors['rgb'] = df_colors['rgb'].apply(lambda x:[round(c, 5) for c in x])df_colors['display color as background'] = ''df_colors.style.apply(format_color_groups, color=df_colors.hex, axis=None)
We can find all the colors from this pallet below:
name | hex | rgb | display color as background | |
---|---|---|---|---|
0 | aliceblue | #F0F8FF | [0.94118, 0.97255, 1.0] | |
1 | antiquewhite | #FAEBD7 | [0.98039, 0.92157, 0.84314] | |
2 | aqua | #00FFFF | [0.0, 1.0, 1.0] | |
3 | aquamarine | #7FFFD4 | [0.49804, 1.0, 0.83137] | |
4 | azure | #F0FFFF | [0.94118, 1.0, 1.0] | |
5 | beige | #F5F5DC | [0.96078, 0.96078, 0.86275] | |
6 | bisque | #FFE4C4 | [1.0, 0.89412, 0.76863] | |
7 | black | #000000 | [0.0, 0.0, 0.0] | |
8 | blanchedalmond | #FFEBCD | [1.0, 0.92157, 0.80392] | |
9 | blue | #0000FF | [0.0, 0.0, 1.0] | |
10 | blueviolet | #8A2BE2 | [0.54118, 0.16863, 0.88627] | |
11 | brown | #A52A2A | [0.64706, 0.16471, 0.16471] | |
12 | burlywood | #DEB887 | [0.87059, 0.72157, 0.52941] | |
13 | cadetblue | #5F9EA0 | [0.37255, 0.61961, 0.62745] | |
14 | chartreuse | #7FFF00 | [0.49804, 1.0, 0.0] | |
15 | chocolate | #D2691E | [0.82353, 0.41176, 0.11765] | |
16 | coral | #FF7F50 | [1.0, 0.49804, 0.31373] | |
17 | cornflowerblue | #6495ED | [0.39216, 0.58431, 0.92941] | |
18 | cornsilk | #FFF8DC | [1.0, 0.97255, 0.86275] | |
19 | crimson | #DC143C | [0.86275, 0.07843, 0.23529] | |
20 | cyan | #00FFFF | [0.0, 1.0, 1.0] | |
21 | darkblue | #00008B | [0.0, 0.0, 0.5451] | |
22 | darkcyan | #008B8B | [0.0, 0.5451, 0.5451] | |
23 | darkgoldenrod | #B8860B | [0.72157, 0.52549, 0.04314] | |
24 | darkgray | #A9A9A9 | [0.66275, 0.66275, 0.66275] | |
25 | darkgreen | #006400 | [0.0, 0.39216, 0.0] | |
26 | darkgrey | #A9A9A9 | [0.66275, 0.66275, 0.66275] | |
27 | darkkhaki | #BDB76B | [0.74118, 0.71765, 0.41961] | |
28 | darkmagenta | #8B008B | [0.5451, 0.0, 0.5451] | |
29 | darkolivegreen | #556B2F | [0.33333, 0.41961, 0.18431] | |
30 | darkorange | #FF8C00 | [1.0, 0.54902, 0.0] | |
31 | darkorchid | #9932CC | [0.6, 0.19608, 0.8] | |
32 | darkred | #8B0000 | [0.5451, 0.0, 0.0] | |
33 | darksalmon | #E9967A | [0.91373, 0.58824, 0.47843] | |
34 | darkseagreen | #8FBC8F | [0.56078, 0.73725, 0.56078] | |
35 | darkslateblue | #483D8B | [0.28235, 0.23922, 0.5451] | |
36 | darkslategray | #2F4F4F | [0.18431, 0.3098, 0.3098] | |
37 | darkslategrey | #2F4F4F | [0.18431, 0.3098, 0.3098] | |
38 | darkturquoise | #00CED1 | [0.0, 0.80784, 0.81961] | |
39 | darkviolet | #9400D3 | [0.58039, 0.0, 0.82745] | |
40 | deeppink | #FF1493 | [1.0, 0.07843, 0.57647] | |
41 | deepskyblue | #00BFFF | [0.0, 0.74902, 1.0] | |
42 | dimgray | #696969 | [0.41176, 0.41176, 0.41176] | |
43 | dimgrey | #696969 | [0.41176, 0.41176, 0.41176] | |
44 | dodgerblue | #1E90FF | [0.11765, 0.56471, 1.0] | |
45 | firebrick | #B22222 | [0.69804, 0.13333, 0.13333] | |
46 | floralwhite | #FFFAF0 | [1.0, 0.98039, 0.94118] | |
47 | forestgreen | #228B22 | [0.13333, 0.5451, 0.13333] | |
48 | fuchsia | #FF00FF | [1.0, 0.0, 1.0] | |
49 | gainsboro | #DCDCDC | [0.86275, 0.86275, 0.86275] | |
50 | ghostwhite | #F8F8FF | [0.97255, 0.97255, 1.0] | |
51 | gold | #FFD700 | [1.0, 0.84314, 0.0] | |
52 | goldenrod | #DAA520 | [0.8549, 0.64706, 0.12549] | |
53 | gray | #808080 | [0.50196, 0.50196, 0.50196] | |
54 | green | #008000 | [0.0, 0.50196, 0.0] | |
55 | greenyellow | #ADFF2F | [0.67843, 1.0, 0.18431] | |
56 | grey | #808080 | [0.50196, 0.50196, 0.50196] | |
57 | honeydew | #F0FFF0 | [0.94118, 1.0, 0.94118] | |
58 | hotpink | #FF69B4 | [1.0, 0.41176, 0.70588] | |
59 | indianred | #CD5C5C | [0.80392, 0.36078, 0.36078] | |
60 | indigo | #4B0082 | [0.29412, 0.0, 0.5098] | |
61 | ivory | #FFFFF0 | [1.0, 1.0, 0.94118] | |
62 | khaki | #F0E68C | [0.94118, 0.90196, 0.54902] | |
63 | lavender | #E6E6FA | [0.90196, 0.90196, 0.98039] | |
64 | lavenderblush | #FFF0F5 | [1.0, 0.94118, 0.96078] | |
65 | lawngreen | #7CFC00 | [0.48627, 0.98824, 0.0] | |
66 | lemonchiffon | #FFFACD | [1.0, 0.98039, 0.80392] | |
67 | lightblue | #ADD8E6 | [0.67843, 0.84706, 0.90196] | |
68 | lightcoral | #F08080 | [0.94118, 0.50196, 0.50196] | |
69 | lightcyan | #E0FFFF | [0.87843, 1.0, 1.0] | |
70 | lightgoldenrodyellow | #FAFAD2 | [0.98039, 0.98039, 0.82353] | |
71 | lightgray | #D3D3D3 | [0.82745, 0.82745, 0.82745] | |
72 | lightgreen | #90EE90 | [0.56471, 0.93333, 0.56471] | |
73 | lightgrey | #D3D3D3 | [0.82745, 0.82745, 0.82745] | |
74 | lightpink | #FFB6C1 | [1.0, 0.71373, 0.75686] | |
75 | lightsalmon | #FFA07A | [1.0, 0.62745, 0.47843] | |
76 | lightseagreen | #20B2AA | [0.12549, 0.69804, 0.66667] | |
77 | lightskyblue | #87CEFA | [0.52941, 0.80784, 0.98039] | |
78 | lightslategray | #778899 | [0.46667, 0.53333, 0.6] | |
79 | lightslategrey | #778899 | [0.46667, 0.53333, 0.6] | |
80 | lightsteelblue | #B0C4DE | [0.6902, 0.76863, 0.87059] | |
81 | lightyellow | #FFFFE0 | [1.0, 1.0, 0.87843] | |
82 | lime | #00FF00 | [0.0, 1.0, 0.0] | |
83 | limegreen | #32CD32 | [0.19608, 0.80392, 0.19608] | |
84 | linen | #FAF0E6 | [0.98039, 0.94118, 0.90196] | |
85 | magenta | #FF00FF | [1.0, 0.0, 1.0] | |
86 | maroon | #800000 | [0.50196, 0.0, 0.0] | |
87 | mediumaquamarine | #66CDAA | [0.4, 0.80392, 0.66667] | |
88 | mediumblue | #0000CD | [0.0, 0.0, 0.80392] | |
89 | mediumorchid | #BA55D3 | [0.72941, 0.33333, 0.82745] | |
90 | mediumpurple | #9370DB | [0.57647, 0.43922, 0.85882] | |
91 | mediumseagreen | #3CB371 | [0.23529, 0.70196, 0.44314] | |
92 | mediumslateblue | #7B68EE | [0.48235, 0.40784, 0.93333] | |
93 | mediumspringgreen | #00FA9A | [0.0, 0.98039, 0.60392] | |
94 | mediumturquoise | #48D1CC | [0.28235, 0.81961, 0.8] | |
95 | mediumvioletred | #C71585 | [0.78039, 0.08235, 0.52157] | |
96 | midnightblue | #191970 | [0.09804, 0.09804, 0.43922] | |
97 | mintcream | #F5FFFA | [0.96078, 1.0, 0.98039] | |
98 | mistyrose | #FFE4E1 | [1.0, 0.89412, 0.88235] | |
99 | moccasin | #FFE4B5 | [1.0, 0.89412, 0.7098] | |
100 | navajowhite | #FFDEAD | [1.0, 0.87059, 0.67843] | |
101 | navy | #000080 | [0.0, 0.0, 0.50196] | |
102 | oldlace | #FDF5E6 | [0.99216, 0.96078, 0.90196] | |
103 | olive | #808000 | [0.50196, 0.50196, 0.0] | |
104 | olivedrab | #6B8E23 | [0.41961, 0.55686, 0.13725] | |
105 | orange | #FFA500 | [1.0, 0.64706, 0.0] | |
106 | orangered | #FF4500 | [1.0, 0.27059, 0.0] | |
107 | orchid | #DA70D6 | [0.8549, 0.43922, 0.83922] | |
108 | palegoldenrod | #EEE8AA | [0.93333, 0.9098, 0.66667] | |
109 | palegreen | #98FB98 | [0.59608, 0.98431, 0.59608] | |
110 | paleturquoise | #AFEEEE | [0.68627, 0.93333, 0.93333] | |
111 | palevioletred | #DB7093 | [0.85882, 0.43922, 0.57647] | |
112 | papayawhip | #FFEFD5 | [1.0, 0.93725, 0.83529] | |
113 | peachpuff | #FFDAB9 | [1.0, 0.8549, 0.72549] | |
114 | peru | #CD853F | [0.80392, 0.52157, 0.24706] | |
115 | pink | #FFC0CB | [1.0, 0.75294, 0.79608] | |
116 | plum | #DDA0DD | [0.86667, 0.62745, 0.86667] | |
117 | powderblue | #B0E0E6 | [0.6902, 0.87843, 0.90196] | |
118 | purple | #800080 | [0.50196, 0.0, 0.50196] | |
119 | rebeccapurple | #663399 | [0.4, 0.2, 0.6] | |
120 | red | #FF0000 | [1.0, 0.0, 0.0] | |
121 | rosybrown | #BC8F8F | [0.73725, 0.56078, 0.56078] | |
122 | royalblue | #4169E1 | [0.2549, 0.41176, 0.88235] | |
123 | saddlebrown | #8B4513 | [0.5451, 0.27059, 0.07451] | |
124 | salmon | #FA8072 | [0.98039, 0.50196, 0.44706] | |
125 | sandybrown | #F4A460 | [0.95686, 0.64314, 0.37647] | |
126 | seagreen | #2E8B57 | [0.18039, 0.5451, 0.34118] | |
127 | seashell | #FFF5EE | [1.0, 0.96078, 0.93333] | |
128 | sienna | #A0522D | [0.62745, 0.32157, 0.17647] | |
129 | silver | #C0C0C0 | [0.75294, 0.75294, 0.75294] | |
130 | skyblue | #87CEEB | [0.52941, 0.80784, 0.92157] | |
131 | slateblue | #6A5ACD | [0.41569, 0.35294, 0.80392] | |
132 | slategray | #708090 | [0.43922, 0.50196, 0.56471] | |
133 | slategrey | #708090 | [0.43922, 0.50196, 0.56471] | |
134 | snow | #FFFAFA | [1.0, 0.98039, 0.98039] | |
135 | springgreen | #00FF7F | [0.0, 1.0, 0.49804] | |
136 | steelblue | #4682B4 | [0.27451, 0.5098, 0.70588] | |
137 | tan | #D2B48C | [0.82353, 0.70588, 0.54902] | |
138 | teal | #008080 | [0.0, 0.50196, 0.50196] | |
139 | thistle | #D8BFD8 | [0.84706, 0.74902, 0.84706] | |
140 | tomato | #FF6347 | [1.0, 0.38824, 0.27843] | |
141 | turquoise | #40E0D0 | [0.25098, 0.87843, 0.81569] | |
142 | violet | #EE82EE | [0.93333, 0.5098, 0.93333] | |
143 | wheat | #F5DEB3 | [0.96078, 0.87059, 0.70196] | |
144 | white | #FFFFFF | [1.0, 1.0, 1.0] | |
145 | whitesmoke | #F5F5F5 | [0.96078, 0.96078, 0.96078] | |
146 | yellow | #FFFF00 | [1.0, 1.0, 0.0] | |
147 | yellowgreen | #9ACD32 | [0.60392, 0.80392, 0.19608] |
6. XKCD_Colors: colors in Pandas and Python
Finally we will cover huge list of named colors in Python: XKCD_Colors. The list contains about 950 colors. So we are going to list only some of them:
The code for listing all 900+ XKCD_Colors in Pandas is similar to the previous ones:
def format_color_groups(df, color): x = df.copy() i = 0 for factor in color: x.iloc[i, :-1] = '' style = f'background-color: {color[i]}' x.loc[i, 'display color as background'] = style i = i + 1 return xcolors = { 'name': mcolors.XKCD_COLORS.keys(), 'hex': mcolors.XKCD_COLORS.values() }df_colors = pd.DataFrame(colors)df_colors['rgb'] = df_colors['hex'].apply(mcolors.hex2color)df_colors['rgb'] = df_colors['rgb'].apply(lambda x:[round(c, 5) for c in x])df_colors['display color as background'] = ''df_colors.style.apply(format_color_groups, color=df_colors.hex, axis=None)
Sample of the first 15 colors:
name | hex | rgb | display color as background | |
---|---|---|---|---|
0 | xkcd:cloudy blue | #acc2d9 | [0.67451, 0.76078, 0.85098] | |
1 | xkcd:dark pastel green | #56ae57 | [0.33725, 0.68235, 0.34118] | |
2 | xkcd:dust | #b2996e | [0.69804, 0.6, 0.43137] | |
3 | xkcd:electric lime | #a8ff04 | [0.65882, 1.0, 0.01569] | |
4 | xkcd:fresh green | #69d84f | [0.41176, 0.84706, 0.3098] | |
5 | xkcd:light eggplant | #894585 | [0.53725, 0.27059, 0.52157] | |
6 | xkcd:nasty green | #70b23f | [0.43922, 0.69804, 0.24706] | |
7 | xkcd:really light blue | #d4ffff | [0.83137, 1.0, 1.0] | |
8 | xkcd:tea | #65ab7c | [0.39608, 0.67059, 0.48627] | |
9 | xkcd:warm purple | #952e8f | [0.58431, 0.18039, 0.56078] | |
10 | xkcd:yellowish tan | #fcfc81 | [0.98824, 0.98824, 0.50588] | |
11 | xkcd:cement | #a5a391 | [0.64706, 0.63922, 0.56863] | |
12 | xkcd:dark grass green | #388004 | [0.21961, 0.50196, 0.01569] | |
13 | xkcd:dusty teal | #4c9085 | [0.29804, 0.56471, 0.52157] | |
14 | xkcd:grey teal | #5e9b8a | [0.36863, 0.60784, 0.54118] |
7. Matplotlib colors palettes - cmaps
In this section we can find list and view of all Matplotlib colors palettes. They are known as cmap
and can be found in Pandas functions like parameters.
In total there are 166 Matplotlib colors palettes:
['magma', 'inferno', 'plasma', 'viridis', 'cividis', 'twilight', 'twilight_shifted', 'turbo', 'Blues', 'BrBG', 'BuGn', 'BuPu', 'CMRmap', 'GnBu', 'Greens', 'Greys', 'OrRd', 'Oranges', 'PRGn', 'PiYG', 'PuBu', 'PuBuGn', 'PuOr', 'PuRd', 'Purples', 'RdBu', 'RdGy', 'RdPu', 'RdYlBu', 'RdYlGn', 'Reds', 'Spectral', 'Wistia', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd', 'afmhot', 'autumn', 'binary', 'bone', 'brg', 'bwr', 'cool', 'coolwarm', 'copper', 'cubehelix', 'flag', 'gist_earth', 'gist_gray', 'gist_heat', 'gist_ncar', 'gist_rainbow', 'gist_stern', 'gist_yarg', 'gnuplot', 'gnuplot2', 'gray', 'hot', 'hsv', 'jet', 'nipy_spectral', 'ocean', 'pink', 'prism', 'rainbow', 'seismic', 'spring', 'summer', 'terrain', 'winter', 'Accent', 'Dark2', 'Paired', 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c', 'magma_r', 'inferno_r', 'plasma_r', 'viridis_r', 'cividis_r', 'twilight_r', 'twilight_shifted_r', 'turbo_r', 'Blues_r', 'BrBG_r', 'BuGn_r', 'BuPu_r', 'CMRmap_r', 'GnBu_r', 'Greens_r', 'Greys_r', 'OrRd_r', 'Oranges_r', 'PRGn_r', 'PiYG_r', 'PuBu_r', 'PuBuGn_r', 'PuOr_r', 'PuRd_r', 'Purples_r', 'RdBu_r', 'RdGy_r', 'RdPu_r', 'RdYlBu_r', 'RdYlGn_r', 'Reds_r', 'Spectral_r', 'Wistia_r', 'YlGn_r', 'YlGnBu_r', 'YlOrBr_r', 'YlOrRd_r', 'afmhot_r', 'autumn_r', 'binary_r', 'bone_r', 'brg_r', 'bwr_r', 'cool_r', 'coolwarm_r', 'copper_r', 'cubehelix_r', 'flag_r', 'gist_earth_r', 'gist_gray_r', 'gist_heat_r', 'gist_ncar_r', 'gist_rainbow_r', 'gist_stern_r', 'gist_yarg_r', 'gnuplot_r', 'gnuplot2_r', 'gray_r', 'hot_r', 'hsv_r', 'jet_r', 'nipy_spectral_r', 'ocean_r', 'pink_r', 'prism_r', 'rainbow_r', 'seismic_r', 'spring_r', 'summer_r', 'terrain_r', 'winter_r', 'Accent_r', 'Dark2_r', 'Paired_r', 'Pastel1_r', 'Pastel2_r', 'Set1_r', 'Set2_r', 'Set3_r', 'tab10_r', 'tab20_r', 'tab20b_r', 'tab20c_r']
The image below show the palette name and the colors:
The code to generate this image can be found on this link: How to view all colormaps available in matplotlib?
8. Conclusion
We saw how to list huge amount of named colors in Python and Matplotlib. We saw also how to use named colors in Pandas.
Finally we learned how to convert different color formats in Python and Pandas.
Multiple examples of Matplotlib colors are shown. This article can be used as a quick guide or reference for Matplotlib colors and Python styling.
FAQs
Full List of Named Colors in Pandas and Python? ›
Seaborn Default Color Palette
Seaborn has six variations of its default color palette: deep , muted , pastel , bright , dark , and colorblind .
- b: blue.
- g: green.
- r: red.
- c: cyan.
- m: magenta.
- y: yellow.
- k: black.
- w: white.
Seaborn Default Color Palette
Seaborn has six variations of its default color palette: deep , muted , pastel , bright , dark , and colorblind .
- b : blue.
- g : green.
- r : red.
- c : cyan.
- m : magenta.
- y : yellow.
- k : black.
- w : white.
The default is called "viridis", but there are many built-in colormaps in matplotlib. This function will only plot the 82 built in colormaps. This function will plot the 82 colormaps and their reverse. There are four main types of colormap: sequential colormaps increase incrementally in brightness or hue.
How do I get a list of elements in a list Python? ›The most straightforward and common way to get the number of elements in a list is to use the Python built-in function len() . As the name function suggests, len() returns the length of the list, regardless of the types of elements in it.
How do I get all elements from a list in Python? ›One of the most basic ways to get the index positions of all occurrences of an element in a Python list is by using a for loop and the Python enumerate function. The enumerate function is used to iterate over an object and returns both the index and element.
How many named colors are there? ›English, for example, has the full set of 11 basic colors: black, white, red, green, yellow, blue, pink, gray, brown, orange and purple. In a 1999 survey by linguists Paul Kay and Luisa Maffi, languages were roughly equally distributed between the basic color categories that they tracked.
What are the names of all the types of colors? ›Three Primary Colors (Ps): Red, Yellow, Blue. Three Secondary Colors (S'): Orange, Green, Violet. Six Tertiary Colors (Ts): Red-Orange, Yellow-Orange, Yellow-Green, Blue-Green, Blue-Violet, Red-Violet, which are formed by mixing a primary with a secondary.
What are the list of color styles? ›The seven major color schemes are monochromatic, analogous, complementary, split complementary, triadic, square, and rectangle (or tetradic).
How to use colormap Python? ›
- Create x and y data points using numpy.
- Plot x and y data points using plot() method.
- Count n finds, number of color lines has to be plotted.
- Iterate in a range (n) and plot the lines.
- Limit the x ticks range.
- Use show() method to display the figure.
Each predefined colormap provides a palette of 256 colors by default.
What is the name of the Colormap in Python? ›Colormaps or Cmap in Python is a very useful tool for data visualization. Matlibpro comes with a number of built-in colormaps, such as sequential, diverging, cyclic, qualitative, miscellaneous, etc. You can modify these default Cmaps or create your own custom ones using Python.
How many colors are in the Seaborn palette? ›Named palettes default to 6 colors, but grabbing the current palette or passing in a list of colors will not change the number of colors unless this is specified. Asking for more colors than exist in the palette will cause it to cycle.
What is the default color of graph in Python? ›For the new defaults, everything is black except for the median and mean lines (if drawn), which are set to the first two elements of the current color cycle.
What color is K in matplotlib? ›In Python, the built-in function len() is used to get the length (the number of items) of a list. You can get the total number of elements with len() . If you want to get the number of occurrences of an element, use the count() method or Counter of the standard library collections.
How do you create a list of elements in Python? ›To create a list in Python, we use square brackets ( [] ). Here's what a list looks like: ListName = [ListItem, ListItem1, ListItem2, ListItem3, ...] Note that lists can have/store different data types.
How to check if list contains all unique elements in Python? ›# Given List Alist = ['Mon','Tue','Wed','Mon'] print("The given list : ",Alist) # Compare length for unique elements if(len(set(Alist)) == len(Alist)): print("All elements are unique. ") else: print("All elements are not unique. ")
What are the 16 named colors? ›Web Standard Color Names
The World Wide Web Consortium (W3C) has listed 16 valid color names for HTML and CSS: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
Are there 256 colors? ›
The maximum number of colors that can be displayed at any one time is 256 or 28.
What are the 12 colors? ›There are 12 main colors on the color wheel. In the RGB color wheel, these hues are red, orange, yellow, chartreuse green, green, spring green, cyan, azure, blue, violet, magenta and rose. The color wheel can be divided into primary, secondary and tertiary colors.
What are the 11 color categories? ›English has 11 basic color terms: 'black', 'white', 'red', 'green', 'yellow', 'blue', 'brown', 'orange', 'pink', 'purple', and 'grey'; other languages have between 2 and 12. All other colors are considered by most speakers of that language to be variants of these basic color terms.
What are the 7 types of colors? ›The colours of the rainbow are: Red, orange, yellow, green, blue, indigo, violet. Can you find items from around the house in each of the seven colours?
Are there 100 colors? ›First of all, scientists have determined that in the lab we can see about 1,000 levels of dark-light and about 100 levels each of red-green and yellow-blue. So that's about 10 million colors right there.
What are the 8 color schemes? ›Check out these classic color schemes including: warm, cool, analogous, complementary, split-complementary, triadic, achromatic, analogous color schemes.
How to set colormap Python? ›- Create random data using numpy, array dimension 4×4.
- Create two axes and one figure using subplots() method.
- Display the data as an image with the default colormap.
- Set the title of the image, for the default colormap.
- Set the default colormap using matplotlib rcParams.
- RGB →(0.255. 0), Hex Code →#00FF00, Color Name →lime.
- RGB →(178,34,34), Hex Code →#B22222, Color Name →firebrick.
Color maps, also known as color tables, are generally represented by n x 3 arrays of red, green, and blue float values (referred to as RGB values) ranging from 0.0 to 1.0 (to indicate the intensity of that particular color).
How many colors are there in coding? ›There are 16,777,216 possible HTML color codes, and all are visible on a 24-bit display. These color codes can change the color of the background, text, and tables on a web page. They can also reference exact colors in photo editing programs like Adobe Photoshop. Major hexadecimal color codes.
How many possible color codes are there? ›
With modern browsers supporting the full spectrum of 24-bit color, there are 16,777,216 different color possibilities.
How many colors are there in data visualization? ›It's no different when it comes to data visualization. The fewer colors, the better. Having too many categories will slow down information processing. Many resources say that the optimal number of colors is between 6 to 8.
How to identify color code from image Python? ›- Download and unzip the zip file. ...
- Taking an image from the user. ...
- Next, we read the CSV file with pandas. ...
- Set a mouse callback event on a window. ...
- Create the draw_function. ...
- Calculate distance to get color name. ...
- Display image on the window.
Color Name | Hex Value | RGB Value |
---|---|---|
black | #000000 | RGB(0,0,0) |
blanchedalmond | #FFEBCD | RGB(255,235,205) |
blue | #0000FF | RGB(0,0,255) |
blue2 | #0000EE | RGB(0,0,238) |
The Colormap function is a type of raster data renderer. It transforms the pixel values to display the raster data as either a grayscale or an RGB color image based on a color scheme or specific colors in a color map file.
How many colors in a limited palette? ›Usually, no more than six different colours will be included in a limited palette. This doesn't include the pigments that create tints (white) and shade (black or burnt umber).
What is the difference between Plotly and matplotlib? ›Matplotlib is also a great place for new Python users to start their data visualization education, because each plot element is declared explicitly in a logical manner. Plotly, on the other hand, is a more sophisticated data visualization tool that is better suited for creating elaborate plots more efficiently.
What are the colors of the seaborn histogram? ›By default, seaborn uses blue as the fill color and black as the outline color for the bars in the histogram.
What are default colors? ›A default color is one that is applied without proper research and is one that is “used on everything”.
How many default colors in matplotlib? ›Matplotlib chooses the first 10 default colors for the lines in the plot. What is this? The output displays the hex color code for each of the ten default colors. For example, the first hex color code is #1f77b4.
What is the RGB color range in Python? ›
In more technical terms, RGB describes a color as a tuple of three components. Each component can take a value between 0 and 255, where the tuple (0, 0, 0) represents black and (255, 255, 255) represents white.
What is the default color name in Pyplot? ›The default color of a scatter point is blue. To get the default blue color of matplotlib scatter point, we can annotate them using annotate() method.
What is the color code for white in Python? ›Using the matplotlib module
CSS4_COLORS. keys() method of this module to get a list of CSS4 different colors and then use the random. choice() function of the random module to choose one of them randomly to display in the console. In this way, we can get different random colors.
To generate random RGB values in Python, the user can utilize the choice() method and the randint() method from the “random” package/module. The choice() works best if the goal of the user is to generate the hexadecimal code of the RGB color.
How do you plot colors in Python? ›For example, you can set the color, marker, linestyle, and markercolor with: plot(x, y, color='green', linestyle='dashed', marker='o', markerfacecolor='blue', markersize=12).
How do you set random colors? ›- function generateRandomColor(){
- let maxVal = 0xFFFFFF; // 16777215.
- let randomNumber = Math. random() * maxVal;
- randomNumber = Math. floor(randomNumber);
- randomNumber = randomNumber. toString(16);
- let randColor = randomNumber. padStart(6, 0);
- return `#${randColor. toUpperCase()}`
- }
To use shuffle, import the Python random package by adding the line import random near the top of your program. Then, if you have a list called x, you can call random. shuffle(x) to have the random shuffle function reorder the list in a randomized way. Note that the shuffle function replaces the existing list.
How can you randomize the items of a list inplace in Python? ›Python Random shuffle() Method
The shuffle() method takes a sequence, like a list, and reorganize the order of the items. Note: This method changes the original list, it does not return a new list.
In Python, you can randomly sample elements from a list with the choice() , sample() , and choices() functions from the random module. These functions can also be used with strings and tuples. choice() returns a single random element, while sample() and choices() return a list of multiple random elements.
How do you generate random unique codes in Python? ›
- Import the UUID module.
- Use one of the functions in the uuid module to generate a UUID.
- The function uuid. ...
- Creates a random UUID using uuid. ...
- Creates a UUID based on a namespace and a name using the function uuid.
Use randint() Generate random integer
Use a random.randint() function to get a random integer number from the inclusive range. For example, random.randint(0, 10) will return a random number from [0, 1, 2, 3, 4, 5, 6, 7, 8 ,9, 10].
The getcolors() function is used to get a list of colors present in the image.
What is the default color in Python? ›For the new defaults, everything is black except for the median and mean lines (if drawn), which are set to the first two elements of the current color cycle.
How do I get different colors on my bar chart? ›On a chart, select the individual data marker that you want to change. On the Format tab, in the Shape Styles group, click Shape Fill. Do one of the following: To use a different fill color, under Theme Colors or Standard Colors, click the color that you want to use.