| |
- ocontour(data, x, y, c_levels=None, colorbar=1, continents=0, ctindex=13, plottype='line')
- Interactively overplot 2-D contour plots.
Overplots a contour plot onto the active VCS canvas. Syntax of
method call is based on IDL conventions. However, defaults for
input parameters are set to my personal preferences, not IDL
defaults.
Default is a generic line contour plot with no axis titles or
overall title, and no colorbar legend plotted at the bottom.
Method Arguments:
* data: 2-D array of data to contour. Location of rows are
described by y, and location of columns by x. Typically
for plots on the earth, x is longitude and y is latitude
so rows in data are bands of constant latitude. Numeric, MA,
MV array. If data is Numeric only, there should be no missing
values in data.
* x: Vector of x-axis variable values, which corresponds to
iterating through the columns of data. Numeric, MA, or MV
vector. There should be no missing values in x.
* y: Vector of y-axis variable values, which corresponds to
iterating through the rows of data. Numeric, MA, or MV
vector. There should be no missing values in y.
NB: If an input argument is MV, only the MA portion of the
variable is used; this procedure does not read the additional
attributes of the MV class.
Keyword Inputs:
* c_levels: Vector of contour levels. Can be list or Numeric
array. Default is None.
* colorbar: If set true (i.e. not equal to 0), a color bar
legend of the filled contour colors is plotted. Default is
true, except when plottype is 'line' the colorbar keyword's
value is ignored and no color bar is plotted.
* continents: If set true (i.e. not equal to 0), fine modern
continent outlines are plotted. Default is false.
* ctindex: Index of color table to use, keyed into the values
used by procedure loadct. The command loadct() will list all
available values. Default is 13 (rainbow, violet to red,
390-680 nm).
* plottype: If set to 'fill', smooth filled contours only are
plotted; if set to 'line', contour lines only are plotted; if
set to 'both', smooth filled contours plus an overlay of contour
lines are plotted. String scalar. Default is 'line'.
Output:
* Overplot contour plot of data on screen of active canvas.
Notes:
* The font for the colorbar text are set to be the overall title
font.
* Color of colorbar text is forced to always be black.
* The colorbar font height is set to 1/2 the overall title height.
* The colorbar height is set to 0.03 (normalized units).
* If contour lines are plotted, negative values are long dashed
and positive values are solid.
* For CDAT 3.3, the case of overplotting a fill contour on top of
a contour map does not work properly. This is fixed in CDAT 4.0.
If you are using CDAT 3.3, be aware that the plot you get if you
do such overplotting will likely be wrong.
Example to overplot a simple line contour plot on top of an x-y
line plot:
import Numeric as N
from ocontour import ocontour
x = N.arange(25) * 15.0 - 180.0
y = N.arange(13) * 15.0 - 90.0
data = N.outerproduct(N.sin(y*N.pi/360.), N.cos(x*N.pi/360.))
plot(x, 90*N.sin(x/20.))
ocontour(data, x, y)
Example to overplot a contour plot with manually set contour
levels (I assume the initial plot or contour command was execu-
ted earlier):
levs = [-0.3, -0.15, 0, 0.4, 0.6, 0.78]
ocontour(data, x, y, c_levels=levs)
|