module graphhelper.mapplot

Short summary

module pyensae.graphhelper.mapplot

Plotting maps.

source on GitHub

Functions

function

truncated documentation

plot_map_france

Creates a map for France using cartopy.

plot_map_france_polygon

Plots polygons into a map for France.

Documentation

Plotting maps.

source on GitHub

pyensae.graphhelper.mapplot.plot_map_france(ax=None, scale='50m')

Creates a map for France using cartopy.

Parameters:
  • ax – existing axes or None to create ones

  • scale – scale in (10m, 50m, 110m)

Returns:

ax

from matplotlib import pyplot as plt
from pyensae.graphhelper import plot_map_france

plot_map_france()
plt.show()

You may want to add ax.set_extent([-5., 10., 38., 52.]) after ax = plot_map_france(). See also example Plot a map of France.

source on GitHub

pyensae.graphhelper.mapplot.plot_map_france_polygon(geometry, colors, ax=None, scale='50m')

Plots polygons into a map for France.

Parameters:
  • geometry – series of polygons

  • colors – colors

  • scale – scale, see map_france()

  • ax – existing axes, None to create one

Returns:

ax

from matplotlib import pyplot as plt
import cartopy.crs as ccrs
from pyensae.datasource import load_french_departements
from pyensae.graphhelper import plot_map_france, plot_map_france_polygon

# loads the French departments
df = load_french_departements()

fig = plt.figure(figsize=(7,7))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
N = float(df.shape[0])
plot_map_france_polygon(
    ax=ax, geometry=df['geometry'],
    colors=[(i/N, i/N, i/N) for i in range(df.shape[0])])

plt.show()

You may want to add ax.set_extent([-5., 10., 38., 52.]) after ax = plot_map_france_polygon(). See also example Plot a map of France.

source on GitHub