Description Usage Arguments Value See Also Examples
This function facilitates a wide array of customized plots,
enabling the user to easily combine matlines
, matpoints
,
lines
, points
, image
, abline
, and
text
elements. An advantage of this technique is that
the plot boundaries defined by xlim
and ylim
are
automatically and correctly set using all sources of relevant
input data to avoid "plot out of bounds" warnings. A second
advantage is with the matlines
and matpoints
plots
in that the optional offset
function can be used to
visually separate each series (column) of the supplied data
matrix in the display, creating a waterfall-like plot. There
are restrictions, however, in that the number of columns of
the matlines
and matpoints
matrices must be the same if supplied.
Also, currently a mix of matlines
-matpoints
with lines
-points
is not supported.
1 2 3 4 |
... |
additional arguments for |
abline. |
a list of named objects. This list must contain either
of the objects |
add |
a logical value. If |
image. |
a list of named objects. At the very least, the
objects |
lines. |
a list of named objects. At the very least, the
objects |
main |
a character string representing the title label. Default: |
matlines. |
a list of named objects. At the very least, the
objects |
matpoints. |
a list of named objects. At the very least, the
objects |
offset |
a numeric scalar representing the vertical offset
to apply between each line in |
offset.fun |
the function to use in calculating the |
points. |
a list of named objects. At the very least, the
objects |
recenter |
a logical value specifying whether
or not to recenter the plot. Default: |
text. |
a list of named objects. At the very least, the
objects |
xlab |
a character string representing the x-axis label. Default: |
ylab |
a character string representing the y-axis label. Default: |
yref |
a logical value. If |
the offsets applied to each column of existing matlines
-matpoints
y data. This vector is returned invisibly.
matlines
, matpoints
, lines
, points
, image
, abline
, text
, par
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | if (!exists("qcset")) data("qcset", package="msProcess")
## define range variables
iz <- seq(7500)
pts <- c(1500,2500,4500)
## plot matrix style objects
offsets <- msPlot(
matlines=list(x=qcset$mz[iz], y=qcset$intensity[iz,1:4],
lty = 1),
matpoints=list(x=qcset$mz[pts], y=qcset$intensity[pts,1:4],
pch=1,cex=2),
text=list(x=c(3,7)*1000, y=c(15,18)*1000,
labels=c("cow","moon"), cex=2, adj=1, col=1:2),
abline=list(v=qcset$mz[pts], h=10000),
xlab="X Label", ylab="Y Label", main="Title",
yref=TRUE)
## plot non-matrix style objects
x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
z <- cos(r^2)*exp(-r/6)
msPlot(
lines=list(x=-60:-55, y=40:45, lwd=5, col=4),
points=list(x=rnorm(30)-65, y=sin(1:30)+35, col=3, pch=2, cex=2),
text=list(x=-65,y=39.5,"Sample text", cex=4, col=2),
image=list(x=x/5-70, y=y/5+45, z=z),
yref=FALSE)
## multiple matlines in a single call
x <- matrix(seq(0,10,by=0.1))
y <- sin(x %*% t(1:4))
msPlot(matlines=list(
list(x=x, y=y, lty=1, lwd=1),
list(x=x, y=y + 0.2, lty=1, lwd=2),
list(x=x, y=y - 0.2, lty=1, lwd=4)),
yref=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.