07 colorbar

Adding custom colorbars to the map
Uncomment the following line to install leafmap if needed.
Continuous colorbar
Add a WMS layer to the map
| Map = leafmap.Map()
url = "https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?"
Map.add_wms_layer(
url,
layers="3DEPElevation:Hillshade Elevation Tinted",
name="USGS 3DEP Elevation",
format="image/png",
transparent=True,
)
|
Add a continuous colorbar with a custom palette to the map.
| colors = ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"]
vmin = 0
vmax = 4000
Map.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
Map
|
Categorical colorbar
Add a WMS layer to the map
| Map = leafmap.Map()
url = "https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?"
Map.add_wms_layer(
url,
layers="3DEPElevation:Hillshade Elevation Tinted",
name="USGS 3DEP Elevation",
format="image/png",
transparent=True,
)
|
Add a categorical colorbar with a custom palette to the map.
| colors = ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"]
vmin = 0
vmax = 4000
Map.add_colorbar(colors=colors, vmin=vmin, vmax=vmax, categorical=True, step=4)
Map
|