colormaps module¶
Module for commonly used colormaps and palettes for visualizing Earth Engine data.
get_colorbar(colors, vmin=0, vmax=1, width=6.0, height=0.4, orientation='horizontal', discrete=False, return_fig=False)
¶
Creates a colorbar based on custom colors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors
|
list
|
A list of hex colors. |
required |
vmin
|
float
|
The minimum value range. Defaults to 0. |
0
|
vmax
|
float
|
The maximum value range. Defaults to 1.0. |
1
|
width
|
float
|
The width of the colormap. Defaults to 6.0. |
6.0
|
height
|
float
|
The height of the colormap. Defaults to 0.4. |
0.4
|
orientation
|
str
|
The orientation of the colormap. Defaults to "horizontal". |
'horizontal'
|
discrete
|
bool
|
Whether to create a discrete colormap. |
False
|
return_fig
|
bool
|
Whether to return the figure. Defaults to False. |
False
|
Source code in geemap/colormaps.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
get_palette(cmap_name=None, n_class=None, hashtag=False)
¶
Get a palette from a matplotlib colormap. See the list of colormaps at https://matplotlib.org/stable/tutorials/colors/colormaps.html.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmap_name
|
str
|
The name of the matplotlib colormap. Defaults to None. |
None
|
n_class
|
int
|
The number of colors. Defaults to None. |
None
|
hashtag
|
bool
|
Whether to return a list of hex colors. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
list |
A list of hex colors. |
Source code in geemap/colormaps.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
list_colormaps(add_extra=False, lowercase=False)
¶
List all available colormaps. See a complete lost of colormaps at https://matplotlib.org/stable/tutorials/colors/colormaps.html.
Returns:
Name | Type | Description |
---|---|---|
list |
The list of colormap names. |
Source code in geemap/colormaps.py
139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
plot_colormap(cmap, width=8.0, height=0.4, orientation='horizontal', vmin=0, vmax=1.0, axis_off=True, show_name=False, font_size=12, return_fig=False)
¶
Plot a matplotlib colormap.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmap
|
str
|
The name of the colormap. |
required |
width
|
float
|
The width of the colormap. Defaults to 8.0. |
8.0
|
height
|
float
|
The height of the colormap. Defaults to 0.4. |
0.4
|
orientation
|
str
|
The orientation of the colormap. Defaults to "horizontal". |
'horizontal'
|
vmin
|
float
|
The minimum value range. Defaults to 0. |
0
|
vmax
|
float
|
The maximum value range. Defaults to 1.0. |
1.0
|
axis_off
|
bool
|
Whether to turn axis off. Defaults to True. |
True
|
show_name
|
bool
|
Whether to show the colormap name. Defaults to False. |
False
|
font_size
|
int
|
Font size of the text. Defaults to 12. |
12
|
return_fig
|
bool
|
Whether to return the figure. Defaults to False. |
False
|
Source code in geemap/colormaps.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
plot_colormaps(width=8.0, height=0.4)
¶
Plot all available colormaps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
float
|
Width of the colormap. Defaults to 8.0. |
8.0
|
height
|
float
|
Height of the colormap. Defaults to 0.4. |
0.4
|
Source code in geemap/colormaps.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|