IaGraph Examples: General Contour Plots

Import Statements and Data

All examples below use the following import statements and data:

>>> import Numeric as N
>>> from IaGraph import *
>>> x = N.arange(29) * 10.0
>>> y = N.arange(21) * 10.0 - 100.0
>>> data = N.outerproduct( N.sin(y*N.pi/360.) \
...                      , N.cos((x-140.)*N.pi/360.))

A link to the full source code for all the examples on this page is at the bottom of this page. For more information on the contour command, type help(contour).


Examples

Filled contour plot plus contour lines and color bar

>>> contour(data, x, y)

Contour lines only

>>> contour(data, x, y, plottype="line")

Filled contours only

>>> contour(data, x, y, plottype="fill")

With titles and selected contours

>>> contour( data, x, y \
...    , title='My Plot', xtitle='X-Axis', ytitle='Y-Axis' \
...    , c_levels=[ -0.8, -0.4, -0.35, -0.3 \
...               , 0.0, 0.2, 0.3, 0.5, 0.55, 0.9 ] )

With titles, blue-red color map, no color bar plotted, and annotation added

>>> contour( data, x, y \
...    , annot='This is my plot.\nBy Johnny Lin\n' \
...           +'December 2003\n\n' \
...           +'University of Chicago\nClimate Systems Center' \
...    , title='My Plot', xtitle='X-Axis', ytitle='Y-Axis' \
...    , ctindex=11, colorbar=0 )

Plot only a partial range of the data

>>> contour(data, x, y, xrange=[80,180], yrange=[-20,80])


Full Code For Examples


Return to IaGraph Home Page.
Return to Johnny Lin's Python Library.

Updated: December 19, 2003 by Johnny Lin <email address>. License.