geo features#

Bokeh offers some geographical features to simplify plotting maps. Some of the functions listed below are also implemented directly in the figure class.

class GEO_FEATURE_COLORS(LAND: 'ColorLike' = '#EFEFDB', STATES: 'ColorLike' = '#EFEFDB', RIVERS: 'ColorLike' = '#9FDBF3', OCEAN: 'ColorLike' = '#9FDBF3', LAKES: 'ColorLike' = '#9FDBF3', BORDERS: 'ColorLike' = '#CCCCCC', MAP_BOUNDARYS: 'ColorLike' = '#000000', COASTLINES: 'ColorLike' = '#000000')[source]#

Bases: object

BORDERS: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#CCCCCC'#
COASTLINES: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#000000'#
LAKES: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#9FDBF3'#
LAND: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#EFEFDB'#
MAP_BOUNDARYS: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#000000'#
OCEAN: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#9FDBF3'#
RIVERS: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#9FDBF3'#
STATES: str | Color | tuple[int, int, int] | tuple[int, int, int, float] = '#EFEFDB'#
add_borders(p, projection, scale='110m', **line_kwargs)[source]#

Adds the borders of countries to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the multi_line() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_borders

p = figure()
p = add_borders(p, ccrs.PlateCarree())
show(p)
add_coastlines(p, projection, scale='110m', **line_kwargs)[source]#

Adds coastlines to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the multi_line() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_coastlines

p = figure()
p = add_coastlines(p, ccrs.PlateCarree())
show(p)
add_lakes(p, projection, scale='110m', **poly_kwargs)[source]#

Adds lakes to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Keyword Arguments:
  • draw_polygon_border (bool, False) – Enables the plotting of the geometry border.

  • draw_polygon_color (str, "black") –

    Sets the color of the geometry border.

    Note

    This functions allows all parameters and keyword arguments defined by the multi_polygons() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_lakes

p = figure()
p = add_lakes(p, ccrs.PlateCarree())
show(p)
add_land(p, projection, scale='110m', **poly_kwargs)[source]#

Adds land geometries including islands to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Keyword Arguments:
  • draw_polygon_border (bool, False) – Enables the plotting of the geometry border.

  • draw_polygon_color (str, "black") –

    Sets the color of the geometry border.

    Note

    This functions allows all parameters and keyword arguments defined by the multi_polygons() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_land

p = figure()
p = add_land(p, ccrs.PlateCarree())
show(p)
add_line_geometries(p, projection, geometries_collection, **line_kwargs)[source]#

Adds line geometries to a map with respect to a given projection. The lines are added by the multi_line() function.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the multi_line() function.

Example

import cartopy.crs as ccrs
import cartopy.feature as cfeature

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_line_geometries

p = figure()
p = add_line_geometries(p, ccrs.PlateCarree(), cfeature.BORDERS)
show(p)
add_ocean(p, projection, scale='110m', **poly_kwargs)[source]#

Adds ocean to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Keyword Arguments:
  • draw_polygon_border (bool, False) – Enables the plotting of the geometry border.

  • draw_polygon_color (str, "black") –

    Sets the color of the geometry border.

    Note

    This functions allows all parameters and keyword arguments defined by the multi_polygons() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_ocean

p = figure()
p = add_ocean(p, ccrs.PlateCarree())
show(p)
add_polygon_geometries(p, projection, geometries_collection, **poly_kwargs)[source]#

Adds polygon geometries to a map with respect to a given projection. The polygons are added by the multi_polygons() function to allow holes and islands. To draw the border of the geometries, set draw_polygon_border to True.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Keyword Arguments:
  • draw_polygon_border (bool, False) – Enables the plotting of the geometry border.

  • draw_polygon_color (str, "black") –

    Sets the color of the geometry border.

    Note

    This functions allows all parameters and keyword arguments defined by the multi_polygons() function.

Example

import cartopy.crs as ccrs
import cartopy.feature as cfeature

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_polygon_geometries

p = figure()
p = add_polygon_geometries(p, ccrs.PlateCarree(), cfeature.LAND)
show(p)
add_projection_boundary(p, projection, **line_kwargs)[source]#

Adds the boundary of a given projection to a map.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the line() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_projection_boundary

p = figure()
p = add_projection_boundary(p, ccrs.EckertIII())
show(p)
add_provinces(p, projection, scale='110m', **line_kwargs)[source]#

Adds the borders of provinces to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the multi_line() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_provinces

p = figure()
p = add_provinces(p, ccrs.PlateCarree())
show(p)
add_rivers(p, projection, scale='110m', **line_kwargs)[source]#

Adds rivers to a map with respect to a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Note

This functions allows all parameters and keyword arguments defined by the multi_line() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_rivers

p = figure()
p = add_rivers(p, ccrs.PlateCarree())
show(p)
add_states(p, projection, scale='110m', **poly_kwargs)[source]#

Adds states and provinces as multi-polygons to a map for a given projection.

Parameters:
  • p (Plot) – Object which should be extended.

  • projection (cartopy.crs.Projection) – Cartopy projection for a geographic map.

  • scale (str, "110m") – Scale of the feature resolution. Valid strings are “110m”, “50m” and “10m”.

Keyword Arguments:
  • draw_polygon_border (bool, False) – Enables the plotting of the geometry border.

  • draw_polygon_color (str, "black") –

    Sets the color of the geometry border.

    Note

    This functions allows all parameters and keyword arguments defined by the multi_polygons() function.

Example

import cartopy.crs as ccrs

from bokeh.plotting import figure, show
from bokeh.plotting._geo_feature import add_states

p = figure()
p = add_states(p, ccrs.PlateCarree(), draw_polygon_border=True)
show(p)