plotSticks {oce} | R Documentation |
Draw a stick-plot diagram
plotSticks(x, y, u, v, yscale=1, add=FALSE, length=1/20, mgp=getOption("oceMgp"), mar=c(mgp[1]+1,mgp[1]+1,1,1+par("cex")), ...)
x |
x coordinates of stick origins. |
y |
y coordinates of stick origins. If not supplied, 0 will be used; if length is less than that of x, the first number is repeated and the rest are ignored. |
u |
x component of stick length. |
v |
y component of stick length. |
yscale |
scale from u and v to y (see “Details”). |
add |
boolean, set |
length |
value to be provided to |
mgp |
3-element numerical vector to use for |
mar |
value to be used with |
... |
graphical parameters passed down to |
The arrows are drawn with directions on the graph that match
the directions indicated by the u
and v
components. The
arrow size is set relative to the units of the y
axis,
according to the value of yscale
, which has the unit of
v
divided by the unit of y
.
The interpretation of diagrams produced by plotSticks
can
be difficult, owing to overlap in the arrows. For this reason, it It
is often a good idea to smooth u
and v
before using this
function.
Dan Kelley
library(oce) # Flow from a point source n <- 16 x <- rep(0, n) y <- rep(0, n) theta <- seq(0, 2*pi, length.out=n) u <- sin(theta) v <- cos(theta) plotSticks(x, y, u, v, xlim=c(-2, 2), ylim=c(-2, 2)) rm(n, x, y, theta, u, v) # Oceanographic example if (require(ocedata)) { data(met) t <- ISOdatetime(met[["Year"]], met[["Month"]], met[["Day"]], 0, 0, 0, tz="UTC") u <- met[["u"]] v <- met[["v"]] temperature <- met[["temperature"]] oce.plot.ts(t, temperature, type='p', ylim=c(-5, 30)) plotSticks(t, 5, u, v, yscale=2, add=TRUE) }