Table Of Contents

Next topic

I/O utilities

This Page

Extensions to Basemap

Tools for plotting maps.

Adding parallels and meridians

get_default_parallels(basemap, resol=1)

Returns an array of default parallels at the given resolution for the current basemap.

Parameters:

basemap : Basemap object

Basemap on which to draw.

resol : {float}, optional

Space between two parallels (in degrees).

get_default_meridians(basemap, resol=1)

Returns an array of default meridians at the given resolution for the current basemap.

Parameters:

basemap : Basemap object

Basemap on which to draw.

resol : {float}, optional

Space between two meridians (in degrees).

draw_default_parallels(basemap, parallels=None, resol=1.0, ax=None, **kwargs)

Draws parallels on the given basemap and axis.

Parameters:

basemap : Basemap object

Basemap on which to draw.

parallels : {None, sequence}, optional

List of meridians to draw. If None, default parallels are determined from the current basemap at the given resolution.

resol : {float}, optional

Space between two parallels (in degrees).

ax : {None, Axe}, optional

Axe on which to draw the parallels. If None, the current axe is selected.

draw_default_meridians(basemap, meridians=None, resol=1.0, ax=None, **kwargs)

Draws meridians on the given basemap and axis.

Parameters:

basemap : Basemap object

Basemap on which to draw.

meridians : {None, sequence}, optional

List of meridians to draw. If None, default meridians are determined from the current basemap at the given resolution.

resol : {float}, optional

Space between two parallels (in degrees).

ax : {None, Axe}, optional

Axe on which to draw the parallels. If None, the current axe is selected.

Adding a colorbar

draw_colorbar(mappable, fig=None, axislist=None, orientation='horizontal', width=0.025000000000000001, offset=0.050000000000000003, **kwargs)

Draws a colorbar for the current mappable object.

In addition to the parameters listed below, the function accepts all the optional parameters of matplotlib.pylab.colorbar.

Parameters:

mappable : :

A mappable object (image, contours...)

fig : {None, Figure}, optional

Figure on which to draw the mappable. If None, uses the current figure.

axislist: {None, sequence}, optional :

List of axes to take as reference for drawing. If None, uses the current list of axes.

orientation : {‘horizontal’, ‘horiz’, ‘h’, ‘vertical’, ‘vert’, ‘v’}, optional

Orientation of the colorbar.

width : {0.025, float}, optional

Width/height of the colorbar, in axes units.

offset : {0.05, optional}

Offest from the right/bottom.

OGR/matplotlib conversions

polygon_to_geometry(polygon)
Creates a new ogr.Geometry object from a matplolib.Polygon.
geometry_to_vertices(geometry)
Creates lists of vertices (x,y) from the current geometry.

mpl_toolkits.basemap.Basemap extensions

fillwaterbodies(basemap, color='blue', inlands=True, ax=None, zorder=None)

Fills the water bodies with color. If inlands is True, inland water bodies are also filled.

Parameters:

basemap : Basemap

The basemap on which to fill.

color : {‘blue’, string, RGBA tuple}, optional

Filling color

inlands : {True, False}, optional

Whether inland water bodies should be filled.

ax : {None, Axes instance}, optional

Axe on which to plot. If None, the current axe is selected.

zorder : {None, integer}, optional

zorder of the water bodies polygons.

author:Pierre GF Gerard-Marchant
contact:pierregmcode_at_gmail_dot_com