07 colorbar
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
Continuous colorbar
In [2]:
Copied!
import leafmap
import leafmap
Add a WMS layer to the map
In [3]:
Copied!
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,
)
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.
In [4]:
Copied!
colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
vmin = 0
vmax = 4000
Map.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
Map
colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
vmin = 0
vmax = 4000
Map.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)
Map
Out[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Categorical colorbar
Add a WMS layer to the map
In [5]:
Copied!
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,
)
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.
In [6]:
Copied!
colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
vmin = 0
vmax = 4000
Map.add_colorbar(colors=colors, vmin=vmin, vmax=vmax, categorical=True, step=4)
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
Out[6]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Last update:
2022-03-14