Learn R Programming

oce (version 0.9-18)

plot.section: Plot a CTD section

Description

Plot a CTD section.

Usage

## S3 method for class 'section':
plot(x,
     which=c(1, 2, 3, 99),
     eos=getOption("oceEOS", default="gsw"),
     at=NULL,
     labels=TRUE,
     grid=FALSE,
     contourLevels=NULL,
     contourLabels=NULL,
     stationIndices,
     coastline=c("best", "coastlineWorld", "coastlineWorldMedium",
                 "coastlineWorldFine", "none"),
     xlim=NULL,
     ylim=NULL,
     map.xlim=NULL,
     map.ylim=NULL,
     clongitude, clatitude, span,
     projection=NULL, parameters=NULL, orientation=NULL,
     xtype=c("distance", "track", "longitude", "latitude", "time"),
     ytype=c("depth", "pressure"),
     ztype=c("contour", "image", "points"),
     zbreaks=NULL, zcol=NULL,
     legend.loc="bottomright",
     adorn=NULL,
     showStations=FALSE,
     showStart=TRUE,
     showBottom=TRUE,
     axes=TRUE,
     mgp=getOption("oceMgp"),
     mar=c(mgp[1]+1, mgp[1]+1, mgp[2]+1, mgp[2] + 0.5),
     col=par("col"), cex=par("cex"), pch=par("pch"),
     debug=getOption("oceDebug"),
     ...)

Arguments

x
a section object, e.g. as created by as.section or read.section.
which
a list of desired plot types, as explained in Details. There may be up to four panels in total, and the desired plots are placed in these panels, in reading order. If only one panel is plotted, par i
eos
equation of state to be used, either "unesco" or "gsw".
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.) I
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
optional contour levels
contourLabels
optional contour labels
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
string giving the coastline to be used in a station map, or "best" to pick the one with highest resolution, or "none" to avoid drawing the coastline.
xlim
optional limit for x axis (only in sections, not map)
ylim
optional limit for y axis (only in sections, not map)
map.xlim, map.ylim
optional limits for station map; map.ylim is ignored if map.xlim is provided.
clongitude, clatitude, span
optional map centre position and span (km)
projection, parameters, orientation
parameters specifying map projection; see mapPlot. If projection="automatic", however, a projection is devised from the data, with stereographic if the mea
xtype
type of x axis, for contour plots, either "distance" for distance (in km) to the first point in the section, "track" for distance along the cruise track, "longitude", "latitude",
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
ztype
string indicating whether to use contours, an image, or points. In the first two cases, the data must be gridded, with identical pressures at each station.
zbreaks, zcol
breaks and colours to be used if ztype="points" or "image". If not provided, a reasonable default is chosen. If zcol is a function, it will be invoked with an argument equal to 1+length
legend.loc
location of legend, as supplied to legend, or set to the empty string to avoid plotting a 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-righ
showStations
logical indicating whether to draw station numbers on maps.
showStart
logical indicating whether to indicate the first station with a different symbol than the others.
showBottom
logical indicating whether to draw the bottom, or a character string indicating the method for plotting the bottom. The allowed methods are: polygon, which fills the space to the bottom, or lines, which d
axes
logical value indicating whether to draw axes.
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").
col
colour, as in par("col").
cex
value to be used with par("cex"), for any use of points, e.g. for which="data".
pch
value to be used with par("pch") (see cex, above.)
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, with one panel for each value of which. The codes are as follows.
  • which=1or"temperature"for temperature contours (the default)
  • which=2or"salinity"for salinity contours
  • which=3or"sigmaTheta"for sigma-theta contours
  • which=4or"nitrate"for nitrate concentration contours
  • which=5or"nitrite"for nitrite concentration contours
  • which=6or"oxygen"for oxygen concentration contours
  • which=7or"phosphate"for phosphate concentration contours
  • which=8or"silicate"for silicate concentration contours
  • which=9or"u"for eastward velocity
  • which=10or"uz"for vertical derivative of eastward velocity
  • which=11or"v"for northward velocity
  • which=12or"vz"for vertical derivative of northward velocity
  • which=20or"data"for a dot for each data location
  • which=99or"map"for a location map
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

The documentation for section-class explains the structure of section objects, and also outlines the other functions dealing with them.

Examples

Run this code
library(oce)
data(section)
sg <- sectionGrid(section)

## AO3 section
plot(sg, which="salinity", ztype="points", pch=20, cex=1.5) 

## Gulf Stream
GS <- subset(section, 109<=stationId&stationId<=129)
GSg <- sectionGrid(GS, p=seq(0,2000,100))
plot(GSg, which=c(1,99), map.ylim=c(34,42))

par(mfrow=c(2,1))
plot(GS, which=1, ylim=c(2000, 0), ztype='points',
zbreaks=seq(0,30,2), pch=20, cex=3)
plot(GSg, which=1, ztype='image', zbreaks=seq(0,30,2))

## image, with coloured dots to show if grid smoothing was OK
plot(GSg, which=1, ztype='image')
T <- GS[['temperature']]
col <- oce.colorsJet(100)[rescale(T, rlow=1, rhigh=100)]
points(GS[['distance']],GS[['depth']],pch=20,cex=3,col='white')
points(GS[['distance']],GS[['depth']],pch=20,cex=2.5,col=col)

Run the code above in your browser using DataLab