multLines | R Documentation |
Plots multiple lines based on a vector x
and a matrix y
,
draws thin vertical lines connecting limits represented by columns of
y
beyond the first. It is assumed that either (1) the second
and third columns of y
represent lower and upper confidence
limits, or that (2) there is an even number of columns beyond the
first and these represent ascending quantiles that are symmetrically
arranged around 0.5. If options(grType='plotly')
is in effect,
uses plotly
graphics instead of grid
or base graphics.
For plotly
you may want to set the list of possible colors,
etc. using pobj=plot_ly(colors=...)
. lwd,lty,lwd.vert
are ignored under plotly
.
multLines(x, y, pos = c('left', 'right'), col='gray',
lwd=1, lty=1, lwd.vert = .85, lty.vert = 1,
alpha = 0.4, grid = FALSE,
pobj=plotly::plot_ly(), xlim, name=colnames(y)[1], legendgroup=name,
showlegend=TRUE, ...)
x |
a numeric vector |
y |
a numeric matrix with number of rows equal to the number of
|
pos |
when |
col |
a color used to connect |
lwd |
line width for main lines |
lty |
line types for main lines |
lwd.vert |
line width for vertical lines |
lty.vert |
line type for vertical lines |
alpha |
transparency |
grid |
set to |
pobj |
an already started |
xlim |
global x-axis limits (required if using |
name |
trace name if using |
legendgroup |
legend group name if using |
showlegend |
whether or not to show traces in legend, if using
|
... |
passed to |
Frank Harrell
if (requireNamespace("plotly")) {
x <- 1:4
y <- cbind(x, x-3, x-2, x-1, x+1, x+2, x+3)
plot(NA, NA, xlim=c(1,4), ylim=c(-2, 7))
multLines(x, y, col='blue')
multLines(x, y, col='red', pos='right')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.