File: examples.rst

package info (click to toggle)
basemap 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 213,536 kB
  • sloc: python: 11,826; sh: 45; makefile: 41
file content (70 lines) | stat: -rw-r--r-- 2,753 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.. _examples:

Plotting data on a map (Example Gallery)
========================================

Following are a series of examples that illustrate how to use Basemap
instance methods to plot your data on a map.  More examples are included
in the doc/examples directory of the basemap source distribution.
There are a number of Basemap instance methods for plotting data:

* :func:`~mpl_toolkits.basemap.Basemap.contour`: draw contour lines.
* :func:`~mpl_toolkits.basemap.Basemap.contourf`: draw filled contours.
* :func:`~mpl_toolkits.basemap.Basemap.imshow`: draw an image.
* :func:`~mpl_toolkits.basemap.Basemap.pcolor`: draw a pseudocolor plot.
* :func:`~mpl_toolkits.basemap.Basemap.pcolormesh`: draw a pseudocolor plot (faster version for regular meshes).
* :func:`~mpl_toolkits.basemap.Basemap.plot`: draw lines and/or markers.
* :func:`~mpl_toolkits.basemap.Basemap.scatter`: draw points with markers.
* :func:`~mpl_toolkits.basemap.Basemap.quiver`: draw vectors.
* :func:`~mpl_toolkits.basemap.Basemap.barbs`: draw `wind barbs <http://en.wikipedia.org/wiki/Station_model#Plotted_winds>`__.
* :func:`~mpl_toolkits.basemap.Basemap.drawgreatcircle`: draw a `great circle <http://en.wikipedia.org/wiki/Great_circle>`__.

Many of these instances methods simply forward to the corresponding matplotlib
`Axes <https://matplotlib.org/api/axes_api.html>`__ instance method, 
with some extra pre/post processing and argument checking. 
You can also plot on the map directly with the matplotlib 
`pyplot <https://matplotlib.org/api/pyplot_api.html>`__ interface,
or the `OO api <https://matplotlib.org/examples/api/index.html>`__, 
using the `Axes <https://matplotlib.org/api/axes_api.html>`__ instance 
associated with the Basemap.

For more specifics of how to use the Basemap instance methods,
see :ref:`api-index`.

Here are the examples (many of which utilize the 
`netcdf4-python <https://unidata.github.io/netcdf4-python/>`__ module
to retrieve datasets over http):

* Plot contour lines on a basemap

.. plot:: source/users/figures/contour1.py

* Plot precip with filled contours

.. plot:: source/users/figures/plotprecip.py

 
* Plot hurricane tracks from a shapefile

.. plot:: source/users/figures/hurrtracks.py
 
* Plot etopo5 topography/bathymetry data as an image (with 
  and without shading from a specified light source).

.. plot:: source/users/figures/plotetopo5.py
 
* Pseudo-color plot of SST and sea ice analysis.

.. plot:: source/users/figures/plotsst.py
 
* Plotting wind vectors and wind barbs.

.. plot:: source/users/figures/plotwindvec.py
 
* Draw great circle between NY and London.

.. plot:: source/users/figures/plotgreatcircle.py
 
* Draw day-night terminator on a map.

.. plot:: source/users/figures/plotdaynight.py