plotlyM  R Documentation 
Generates multiple plotly graphics, driven by specs in a data frame
plotlyM(
data,
x = ~x,
y = ~y,
xhi = ~xhi,
yhi = ~yhi,
htext = NULL,
multplot = NULL,
strata = NULL,
fitter = NULL,
color = NULL,
size = NULL,
showpts = !length(fitter),
rotate = FALSE,
xlab = NULL,
ylab = NULL,
ylabpos = c("top", "y"),
xlim = NULL,
ylim = NULL,
shareX = TRUE,
shareY = FALSE,
height = NULL,
width = NULL,
nrows = NULL,
ncols = NULL,
colors = NULL,
alphaSegments = 1,
alphaCline = 0.3,
digits = 4,
zeroline = TRUE
)
data 
input data frame 
x 
formula specifying the xaxis variable 
y 
formula for yaxis variable 
xhi 
formula for upper x variable limits ( 
yhi 
formula for upper y variable limit ( 
htext 
formula for hovertext variable 
multplot 
formula specifying a variable in 
strata 
formula specifying an optional stratification variable 
fitter 
a fitting such as 
color 

size 

showpts 
if 
rotate 
set to 
xlab 
xaxis label. May contain html. 
ylab 
a named vector of yaxis labels, possibly containing html (see example below). The names of the vector must correspond to levels of the 
ylabpos 
position of yaxis labels. Default is on top left of plot. Specify 
xlim 
2vector of xaxis limits, optional 
ylim 
2vector of yaxis limits, optional 
shareX 
specifies whether xaxes should be shared when they align vertically over multiple plots 
shareY 
specifies whether yaxes should be shared when they align horizontally over multiple plots 
height 
height of the combined image in pixels 
width 
width of the combined image in pixels 
nrows 
the number of rows to produce using 
ncols 
the number of columns to produce using 
colors 
the color palette. Leave unspecified to use the default 
alphaSegments 
alpha transparency for line segments (when 
alphaCline 
alpha transparency for lines used to connect points 
digits 
number of significant digits to use in constructing hovertext 
zeroline 
set to 
Generates multiple plotly
traces and combines them with plotly::subplot
. The traces are controlled by specifications in data frame data
plus various arguments. data
must contain these variables: x
, y
, and tracename
(if color
is not an "AsIs" color such as ~ I('black')
), and can contain these optional variables: xhi
, yhi
(rows containing NA
for both xhi
and yhi
represent points, and those with nonNA
xhi
or yhi
represent segments, connect
(set to TRUE
for rows for points, to connect the symbols), legendgroup
(see plotly
documentation), and htext
(hovertext). If the color
argument is given and it is not an "AsIs" color, the variable named in the color
formula must also be in data
. Likewise for size
. If the multplot
is given, the variable given in the formula must be in data
. If strata
is present, another level of separate plots is generated by levels of strata
, within levels of multplot
.
If fitter
is specified, x,y coordinates for an individual plot are
run through fitter
, and a line plot is made instead of showing data points. Alternatively you can specify fitter='ecdf'
to compute and plot emirical cumulative distribution functions.
plotly
object produced by subplot
Frank Harrell
## Not run:
set.seed(1)
pts < expand.grid(v=c('y1', 'y2', 'y3'), x=1:4, g=c('a', 'b'), yhi=NA,
tracename='mean', legendgroup='mean',
connect=TRUE, size=4)
pts$y < round(runif(nrow(pts)), 2)
segs < expand.grid(v=c('y1', 'y2', 'y3'), x=1:4, g=c('a', 'b'),
tracename='limits', legendgroup='limits',
connect=NA, size=6)
segs$y < runif(nrow(pts))
segs$yhi < segs$y + runif(nrow(pts), .05, .15)
z < rbind(pts, segs)
xlab < labelPlotmath('X<sub>12</sub>', 'm/sec<sup>2</sup>', html=TRUE)
ylab < c(y1=labelPlotmath('Y1', 'cm', html=TRUE),
y2='Y2',
y3=labelPlotmath('Y3', 'mm', html=TRUE))
W=plotlyM(z, multplot=~v, color=~g, xlab=xlab, ylab=ylab, ncols=2,
colors=c('black', 'blue'))
W2=plotlyM(z, multplot=~v, color=~I('black'), xlab=xlab, ylab=ylab,
colors=c('black', 'blue'))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.