ez.scatterplot | R Documentation |
scatter plot with lattice
ez.scatterplot(
df,
cmd,
lmline = TRUE,
loess = FALSE,
model = c("lm", "lmrob", "lmRob", "rlm"),
type = c("spartial", "partial"),
scale = FALSE,
rp = TRUE,
rp.x = 0.025,
rp.y = 0.05,
se = TRUE,
layout = NULL,
rp.size = 14,
line.width = 3,
point.size = 14,
x.axis.size = 16,
y.axis.size = 16,
x.lab.size = 18,
y.lab.size = 18,
title.size = 20,
legend.size = c(0, 14),
line.color = "#BE1B22",
line.style = 1,
loess.color = "dark grey",
loess.width = 3,
loess.style = 2,
point.color = "#0086B8",
point.shape = 16,
point.alpha = 0.9,
colors = ez.palette("Zhu"),
shapes = c(16, 17, 15, 3, 7, 8),
ylab = NULL,
xlab = NULL,
xbreaks = NULL,
ybreaks = NULL,
xlimits = NULL,
ylimits = NULL,
title = NULL,
zlab = NULL,
legend.box = FALSE,
legend.position = "top",
legend.direction = "horizontal",
hack = FALSE,
print2scr = TRUE,
...
)
df |
data frame |
cmd |
like "y~x+a+b", "y~x+a+b|z", "y~x+a+b||z", "y~x+a+b|||z"where y x are continous, z discrete (| one regression line, || multiple regression lines by levels of z–gives interaction p value), +a+b optional for covariates residualization
|
lmline |
T/R lmline (for all data points), particularlly useful when separate lines are plotted for each group |
loess |
T/R adds a loess fit (uses panel.loess, the same as type = c("smooth")) |
model |
one of c('lm', 'lmrob', 'lmRob', 'rlm'), robustbase::lmrob–MM-type Estimators; robust::lmRob–automatically chooses an appropriate algorithm. one or more, 'lm' will always be included internally, even if not specified |
type |
one of c('partial','spartial'), or c('p','sp'), plot partial or semi-partial correlation. Only applicable when covar exists |
scale |
when having covariates, z transform residuals |
rp |
show r (signed) and p values |
rp.x |
r p values x position (0-1, relative to top left, big–>right), ignored if rp=FALSE. |
rp.y |
r p values y position (0-1, relative to top left, big–>up), ignored if rp=FALSE. |
se |
standard error of linear regression line |
rp.size |
r p values font size, ignored if rp=FALSE |
point.size |
if less point, one can increase size |
legend.size |
c(0,12) the first number 0 controls the legend title, 0=hide; the second number controls legend.key.size, legend.text |
line.color |
only applicable when not auto varied, regression line color. |
point.color |
only applicable when not auto varied |
point.shape |
only applicable when not auto varied |
point.alpha |
if overplot for points, one can reduce alpha |
ylab |
y label. NULL |
xlab |
x label. NULL |
xbreaks |
seq(from=95, by=0.25, to=97). xbreaks does not require xlimits set |
xlimits |
c(0,1). xlimits does not require xbreaks set |
zlab |
z legend label/title, only applicable when there is z provided. NULL |
legend.box |
box of legend, T or F |
legend.position |
legend position 'none' (I think this is not natively supported, but works) "left", "right", "top", and "bottom"
|
legend.direction |
horizontal or vertical |
hack |
T/F if more than 1 model specified, plot all in one plot |
... |
other parameters passed to |
a lattice plot, can use update() to change the plot, e.g., pp=update(pp,scales=list(y=list(at=ybreaks)))
specify auto through param colors, shapes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.