Learn R Programming

oce (version 0.2-1)

plot.section: Plot a CTD section

Description

Plot a CTD section.

Usage

## S3 method for class 'section':
plot(x,
     which=1:4,
     at=NULL,
     labels=TRUE,
     grid=FALSE,
     contourLevels=NULL,
     contourLabels=NULL,
     stationIndices,
     coastline=NULL,
     xlim=NULL,
     ylim=NULL,
     map.xlim=NULL,
     map.ylim=NULL,
     xtype="distance",
     ytype="depth",
     legend.loc="bottomright",
     adorn=NULL,
     mgp=getOption("oceMgp"),
     mar=c(mgp[1]+1, mgp[1]+1, mgp[2], mgp[2] + 0.5),
     debug=getOption("oceDebug"),
     ...)

Arguments

x
a section object, e.g. as created by makeSection.
which
list of desired plot types. There may be up to four panels in total, and the desired plots are placed in these panels, in reading order. Set which=1 or "temperature" to contour temperature, to 2 or
at
if NULL (the default), the x axis will indicate the distance of the stations from the first in the section. (This may give errors in the contouring routine, if the stations are not present in a geographical order.) If a list, th
labels
either a logical, indicating whether to put labels on the x axis, or a vector that is a list of labels to be placed at the x positions indicated by at.
grid
if TRUE, points are drawn at data locations.
contourLevels
if not NULL, and if a field was specified, this specifies contour levels (see details)
contourLabels
if not NULL, and if a field was specified, this specifies contour labels (see details)
stationIndices
optional list of the indices of stations to use. Note that an index is not a station number, e.g. to show the first 4 stations, use station.indices=1:4.
coastline
optional coastline to be used in a station map
xlim
optional limit for x axis (only in sections, not map)
ylim
optional limit for y axis (only in sections, not map)
map.xlim
optional xlim for station location, which can be helpful in ensuring that a recognizable coastline can be seen. (This value is used instead of map.ylim, if both are supplied.)
map.ylim
optional ylim for station location, which can be helpful in ensuring that a recognizable coastline can be seen
xtype
type of x axis, for contour plots, either "distance" for distance (in km) to the first point in the section, or "track" for distance along the cruise track. Note that if the x values are not in order, they will be put
ytype
type of y axis for contour plots, either "pressure" for pressure (in dbar, with zero at the surface) or "depth" for depth (in m below the surface, calculated from pressure with sw
legend.loc
location of legend, as supplied to legend.
adorn
list of expressions to be executed for the panels in turn, e.g. to adorn the plots. If the number matches the number of panels, then the strings are applied to the appropriate panels, as they are drawn from top-left to bottom-right. If only
mgp
3-element numerical vector to use for par(mgp), and also for par(mar), computed from this. The default is tighter than the R default, in order to use more space for the data and less for the axes.
mar
value to be used with par("mar").
debug
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.
...
optional arguments passed to the contouring function, e.g. using labcex=1 will increase the size of contour labels.

Value

  • None.

Details

Creates a summary plot for a CTD section. If a field is supplied, then just that single field is contoured. If no field is supplied, then temperature, salinity, and sigma are contoured. A location plot is also drawn if a coastline is provided; in this, the first station in the section is indicated with a different symbol than the rest.

The y-axis for the contours is pressure, plotted in the conventional reversed form, so that the water surface appears at the top of the plot. The x-axis is more complicated. If at is not supplied, then the routine calculates x as the distance between the first station in the section and each of the other stations. (This will produce an error if the stations are not ordered geographically, because the contour routine cannot handle non-increasing axis coordinates.) If at is specified, then it is taken to be the location, in arbitrary units, along the x-axis of labels specified by labels; the way this works is designed to be the same as for axis.

See Also

Sections may be created with makeSection or read.section, and may be summarized with summary.section.

Examples

Run this code
library(oce)
# Halifax Harbour
data(section)
data(coastlineHalifax)
plot(section, coastline=coastlineHalifax)

# Gulf Stream
data(a03)
GS <- subset(a03, indices=124:102)
GSg <- sectionGrid(GS, p=seq(0,2000,100))
data(coastlineWorld)
plot(GSg, coastline=coastlineWorld, map.xlim=c(-80,-60))
# Illustate adornment
plot(GSg, coastline=coastlineWorld, map.xlim=c(-80,-60),
     adorn=expression({abline(v=200,col='blue')}))

Run the code above in your browser using DataLab