plot,glider-method | R Documentation |
This is a limited function that is intended for quick views of a dataset. More serious analysis is best done by extracting data and using whatever graphical methods best suit the task at hand.
## S4 method for signature 'glider'
plot(x, which, col = 1, colorby = NULL, colorbylim, simplify = NA, debug, ...)
x |
a [glider-class object. |
which |
either an integer or character value specifying which style is to be used; see “Details”. |
col |
colour to be used for lines or characters. Note that if
|
colorby |
character value, ignored for line plots, that names
a data variable to be indicated on the plot through the
colourization of individual plotted points (i.e. |
colorbylim |
optional value, used only if |
simplify |
either NA or an integer value, that will be supplied
to |
debug |
an integer specifying whether debugging information is
to be printed during processing. If this is not provided, then
the value of |
... |
ignored. |
The form of the plot is set by the which
argument, as follows.
which=0
or which="map"
: plot a map of sampling locations.
This can be quite slow with the default plot type (using points),
so you may find it helpful to use plot(g, type="l")
to get a
quick plot. If you want to change the view, e.g. expanding it so
coastline are visible, start by drawing a coastline using the
oce package, and then add dots with
points(g[["longitude"]], g[["latitude"]]
or similar. This method
is more flexible than the present plot()
function.
which=1
or which="p"
: time-series plot
of pressure, produced with oce::oce.plot.ts()
.
which=2
or which="T"
: time-series plot
of temperature , produced with oce::oce.plot.ts()
.
which=3
or which="S"
: time-series plot
of salinity, produced with oce::oce.plot.ts()
.
which=4
or which="TS"
: temperature-salinity diagram, with
dots for data produced with oce::plotTS()
.
which=5
or which="navState"
: ignored except for
seaexplorer data, this means to plot a time-series of the
navigation state, stored as the navState
item within the
payload1
element of the data
slot. The meanings of the
navState
values for seaexplorer
data are:
105
: glider is not navigating yet
115
: glider is surfacing, with ballast and centre of
gravity being adjusted to put antenna out of the water
116
: glider is at the surface, acquiring a GPS signal, and
communicating
110
: ballast and centre of mass are adjusted to cause
glider to inflect downward
100
: ballast is in diving position; adjustments may be made
to adjust pitch and heading
118
: target depth or altitude has been achieved, so ballast
and centre of mass are adjusted to inflect glider upwards
117
: glider is ascending, with controls being
adjusted for desired pitch and heading
Lines and notes in the plot border indicate these states, both
numerically and with phrases, as inferred by navStateCodes()
.
library(oceglider)
# Example 1: various plot types, using defaults
directory <- system.file("extdata/sea_explorer/delayed_raw", package = "oceglider")
g <- read.glider.seaexplorer.raw(directory, "pld1.raw", progressBar = FALSE)
plot(g, which = "p")
plot(g, which = "S")
plot(g, which = "T")
plot(g, which = "TS")
plot(g, which = "map")
plot(g, which = "navState")
# Example 2: colour-code p by temperature, autoscaled
plot(g, which = "p", type = "p", pch = 20, colorby = "temperature")
# Example 3: colour-code p by temperature, with a colour palette,
# and more aesthetic control, e.g. setting limits using quantiles.
temperature <- g[["temperature"]]
cm <- colormap(temperature,
zlim = quantile(temperature, c(0.01, 0.99), na.rm = TRUE),
col = oceColorsTurbo
)
par(mar = c(2, 3.5, 2, 4))
drawPalette(colormap = cm)
plot(g, which = "p", type = "p", col = cm$zcol, mar = c(2, 3.5, 2, 4), pch = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.