plot,section-method | R Documentation |
Creates a summary plot for a CTD section, with one panel for each value of
which
.
## S4 method for signature 'section'
plot(
x,
which = c(1, 2, 3, 99),
eos,
at = NULL,
labels = TRUE,
grid = FALSE,
contourLevels = NULL,
contourLabels = NULL,
stationIndices,
coastline = "best",
colLand = "gray",
xlim = NULL,
ylim = NULL,
zlim = NULL,
zbreaks = NULL,
zcol = NULL,
map.xlim = NULL,
map.ylim = NULL,
clongitude,
clatitude,
span,
projection = NULL,
xtype = "distance",
ytype = "depth",
ztype = "contour",
longitude0,
latitude0,
legend.loc = "bottomright",
legend.text = NULL,
showStations = FALSE,
showStart = TRUE,
stationTicks = TRUE,
showBottom = TRUE,
showSpine = TRUE,
drawPalette = TRUE,
axes = TRUE,
mgp,
mar,
col,
cex,
pch,
lwd,
labcex = par("cex"),
debug = getOption("oceDebug", 0),
...
)
x |
a section object. |
which |
a list of desired plot types, as explained in “Details”.
Plot types not listed in “Details” can be generated using the
name of the data in the section object.
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, |
eos |
Character indication of the seawater equation of state
to use. The permitted choices are |
at |
If |
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 |
grid |
If |
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 |
coastline |
Either a coastline object to be used,
or a string. In the second case, the permitted
choices are |
colLand |
colour used to fill in land areas if |
xlim |
Optional limit for x axis (only in sections, not map). |
ylim |
Optional limit for y axis (only in sections, not map) |
zlim , zbreaks , zcol |
Elements that control colours for |
map.xlim , map.ylim |
Optional limits for station map; |
clongitude , clatitude , span |
Optional map centre position and span (km). |
projection |
Parameter specifying map
projection; see |
xtype |
Type of x axis, for contour plots, either |
ytype |
Type of y axis for contour plots, either |
ztype |
String indicating whether to how to indicate the "z"
data (in the R sense, i.e. this could be salinity, temperature, etc; it does
not mean the vertical coordinate) The choices are: |
longitude0 , latitude0 |
Location of the point from which distance is measured.
These values are ignored unless |
legend.loc |
Location of legend, as supplied to |
legend.text |
character value indicating the text for the legend.
If this is NULL (the default) then the legend is automatically
constructed by |
showStations |
Logical indicating whether to draw station numbers on maps. |
showStart |
Logical indicating whether to indicate the first station with |
stationTicks |
A logical value indicating whether to indicate station
locations with ticks at the top margin of cross-section plots. Setting this
parameter to |
showBottom |
a value indicating whether (and how) to indicate the
ocean bottom on cross-section views. There are three possibilities.
(a) If |
showSpine |
logical value used if |
drawPalette |
logical value indicating whether to draw a palette when |
axes |
Logical value indicating whether to draw axes. |
mgp |
A 3-element numerical vector to use for |
mar |
Value to be used with |
col |
Color for line types. If not provided, this defaults to
|
cex |
Numerical character-expansion factor, which defaults to |
pch |
Indication of symbol type; defaults to |
lwd |
line width; defaults to |
labcex |
Size of characters in contour labels (passed to
|
debug |
an integer specifying whether debugging information is
to be printed during the processing. This is a general parameter that
is used by many |
... |
Optional arguments passed to the contouring function. |
The type of plot is governed by which
, as follows.
which=0
or "potential temperature"
for potential temperature contours
which=1
or "temperature"
for in-situ temperature contours (the default)
which=2
or "salinity"
for salinity contours
which=3
or "sigmaTheta"
for sigma-theta contours
which=4
or "nitrate"
for nitrate concentration contours
which=5
or "nitrite"
for nitrite concentration contours
which=6
or "oxygen"
for oxygen concentration contours
which=7
or "phosphate"
for phosphate concentration contours
which=8
or "silicate"
for silicate concentration contours
which=9
or "u"
for eastward velocity
which=10
or "uz"
for vertical derivative of eastward velocity
which=11
or "v"
for northward velocity
which=12
or "vz"
for vertical derivative of northward velocity
which=20
or "data"
for a dot for each data location
which=99
or "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()
.
If the original section was gridded, the return value is that section. Otherwise, the gridded section that was constructed for the plot is returned. In both cases, the value is returned silently. The purpose of returning the section is to enable subsequent processing of the grid, including adding elements to the plot (see example 5).
The following examples were once part of the “Examples” section, but were moved here in May 2022, to reduce the build-check time for CRAN submission.
library(oce) data(section) GS <- subset(section, 113<=stationId&stationId<=129) GSg <- sectionGrid(GS, p=seq(0, 2000, 100)) # Gulf Stream, salinity data and contoured 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)) # Gulf Stream, temperature grid (image) and data (dots) par(mfrow=c(1, 1)) plot(GSg, which=1, ztype="image") T <- GS[["temperature"]] col <- oceColorsViridis(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) # 4. Image of temperature, with a high-salinity contour on top; # note the Mediterranean water. sec <- plot(section, which="temperature", ztype="image") S <- sec[["salinity", "grid:distance-pressure"]] contour(S$distance, S$pressure, S$field, level=35.8, lwd=3, add=TRUE) # 5. Contours of salinity, with dots for high pressure and spice plot(section, which="salinity") distance <- section[["distance"]] depth <- section[["depth"]] spice <- section[["spice"]] look <- spice > 1.8 & depth > 500 points(distance[look], depth[look], col="red") # Image of Absolute Salinity, with 4-minute bathymetry # It's easy to calculate the desired area for the bathymetry, # but for brevity we'll hard-code it. Note that download.topo() # requires the "ncdf4" package to have been installed. if (requireNamespace("ncdf4")) { f <- download.topo(west=-80, east=0, south=35, north=40, resolution=4) t <- read.topo(f) plot(section, which="SA", xtype="longitude", ztype="image", showBottom=t) } # Temperature with salinity added in red plot(GSg, which="temperature") distance <- GSg[["distance", "byStation"]] depth <- GSg[["station", 1]][["depth"]] S <- matrix(GSg[["salinity"]], byrow=TRUE, nrow=length(GSg[["station"]])) contour(distance, depth, S, col=2, add=TRUE) # Image with controlled colours plot(GSg, which="salinity", ztype="image", zlim=c(35, 37.5), zbreaks=seq(35, 37.5, 0.25), zcol=oceColorsTurbo)
Dan Kelley, with help from Clark Richards and Chantelle Layton.
The documentation for section explains the structure of section objects, and also outlines the other functions dealing with them.
Other functions that plot oce data:
download.amsr()
,
plot,adp-method
,
plot,adv-method
,
plot,amsr-method
,
plot,argo-method
,
plot,bremen-method
,
plot,cm-method
,
plot,coastline-method
,
plot,ctd-method
,
plot,gps-method
,
plot,ladp-method
,
plot,landsat-method
,
plot,lisst-method
,
plot,lobo-method
,
plot,met-method
,
plot,odf-method
,
plot,rsk-method
,
plot,satellite-method
,
plot,sealevel-method
,
plot,tidem-method
,
plot,topo-method
,
plot,windrose-method
,
plot,xbt-method
,
plotProfile()
,
plotScan()
,
plotTS()
,
tidem-class
Other things related to section data:
[[,section-method
,
[[<-,section-method
,
as.section()
,
handleFlags,section-method
,
initializeFlagScheme,section-method
,
read.section()
,
section
,
section-class
,
sectionAddStation()
,
sectionGrid()
,
sectionSmooth()
,
sectionSort()
,
subset,section-method
,
summary,section-method
library(oce)
data(section)
GS <- subset(section, 113 <= stationId & stationId <= 129)
GSg <- sectionGrid(GS, p = seq(0, 2000, 100))
# Gulf Stream, salinity and temperature contours
plot(GSg, which = c("salinity", "temperature"))
# Gulf Stream, Temperature image
plot(GSg,
which = "temperature", ztype = "image",
zbreaks = seq(0, 25, 2), zcol = oceColorsTemperature
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.