Scatterplot function for class 'data.frame'.
scatter_data_frame(
x,
yvar,
xvar,
groups = NULL,
facets = NULL,
log = metOption("log_scatter", FALSE),
ylog = metOption("ylog_scatter", log),
xlog = metOption("xlog_scatter", log),
crit = metOption("crit_scatter", 1.3),
yref = metOption("yref_scatter", "metaplot_ref"),
xref = metOption("xref_scatter", "metaplot_ref"),
ylab = metOption("ylab_scatter", "axislabel"),
xlab = metOption("xlab_scatter", "axislabel"),
ysmooth = metOption("ysmooth_scatter", FALSE),
xsmooth = metOption("xsmooth_scatter", FALSE),
iso = metOption("iso_scatter", FALSE),
na.rm = metOption("na.rm_scatter", TRUE),
aspect = metOption("aspect_scatter", 1),
space = metOption("space_scatter", "right"),
key = metOption("key_scatter", "metaplot_key"),
as.table = metOption("as.table_scatter", TRUE),
prepanel = metOption("prepanel_scatter", NULL),
isoprepanel = metOption("isoprepanel_scatter", "iso_prepanel"),
scales = metOption("scales_scatter", NULL),
panel = metOption("panel_scatter", "scatter_panel"),
points = metOption("points_scatter", TRUE),
colors = metOption("colors_scatter", NULL),
fill = metOption("fill_scatter", NULL),
symbols = metOption("symbols_scatter", NULL),
sizes = metOption("sizes_scatter", 1),
types = metOption("types_scatter", "solid"),
widths = metOption("widths_scatter", 1),
lines = metOption("lines_scatter", FALSE),
main = metOption("main_scatter", NULL),
sub = metOption("sub_scatter", NULL),
subscripts = metOption("subscripts_scatter", TRUE),
settings = metOption("settings_scatter", NULL),
padding = metOption("padding_scatter", 1),
ref.col = metOption("ref.col_scatter", "grey"),
ref.lty = metOption("ref.lty_scatter", "solid"),
ref.lwd = metOption("ref.lwd_scatter", 1),
ref.alpha = metOption("ref.alpha_scatter", 1),
xref.col = metOption("xref.col_scatter", NULL),
xref.lty = metOption("xref.lty_scatter", NULL),
xref.lwd = metOption("xref.lwd_scatter", NULL),
xref.alpha = metOption("xref.alpha_scatter", NULL),
yref.col = metOption("yref.col_scatter", NULL),
yref.lty = metOption("yref.lty_scatter", NULL),
yref.lwd = metOption("yref.lwd_scatter", NULL),
yref.alpha = metOption("yref.alpha_scatter", NULL),
smooth.lty = metOption("smooth.lty_scatter", "dashed"),
smooth.lwd = metOption("smooth.lwd_scatter", 1),
smooth.alpha = metOption("smooth.alpha_scatter", 1),
fit = metOption("fit_scatter", conf),
fit.lty = metOption("fit.lty_scatter", "solid"),
fit.lwd = metOption("fit.lwd_scatter", 1),
fit.alpha = metOption("fit.alpha_scatter", 1),
conf = metOption("conf_scatter", FALSE),
conf.alpha = metOption("conf.alpha_scatter", 0.3),
loc = metOption("loc_scatter", 0),
global = metOption("global_scatter", FALSE),
global.col = metOption("global.col_scatter", "grey"),
global.fill = metOption("global.fill_scatter", "grey"),
msg = metOption("msg_scatter", "metastats"),
gg = metOption("gg_scatter", FALSE),
verbose = metOption("verbose", FALSE),
...
)
data.frame
character: y variable(s)
character: x variable
optional grouping variable; ignored if more than one yvar
optional conditioning variables
a default shared by ylog
and xlog
log transform y axis (auto-selected if NA)
log transform x axis (auto-selected if NA)
if ylog or xlog missing, log transform if mean/median ratio for non-missing values is greater than crit
reference line from y axis; can be function(x = x, var = yvar, ...) or NULL to suppress
reference line from x axis; can be function(x = x, var = xvar, ...) or NULL to suppress
y axis label; can be function(x = x, var = yvar, log = ylog, ..)
x axis label; can be function(x = x, var = xvar, log = xlog, ..)
supply loess smooth of y on x
supply loess smmoth of x on y
logical: plot line of unity (auto-selected if NA); can be a (partial) list of aesthetics (col, lty, lwd, alpha)
whether to remove data points with one or more missing coordinates
passed to bwplot
or ggplot; use 'fill', NA, or NULL to calculate automatically
location of key (right, left, top, bottom)
list: passed to xyplot
as auto.key
or to theme
; can be a function groups name, groups levels, points, lines, space, gg, and ... . See metaplot_key
.
passed to xyplot
passed to xyplot
(guessed if NULL)
passed to xyplot
if iso is TRUE
passed to xyplot
or facet_grid
or facet_wrap
(guessed if NULL)
name or definition of panel function
whether to plot points and fill for each group: logical, or alpha values between 0 and 1
replacements for default colors in group order; can be length one integer to auto-select that many colors
replacements for default fill colors in group order (means something different
for densplot_data_frame
and categorical_data_frame
). Used for confidence
regions and for filling symbols (pch 21:25).
replacements for default symbols in group order (i.e. values of pch)
replacements for default symbol sizes in group order
replacements for default line types in group order
replacements for default line widths in group order
whether to plot lines for each group: logical, or alpha values between 0 and 1. Points are connected in the order in which they appear in the data.
character, or a function of x, yvar, xvar, groups, facets, and log
character, or a function of x, yvar, xvar, groups, facets, and log
passed to xyplot
default parameter settings: a list from which matching elements are passed to lattice (as par.settings) or to ggplot theme() and facet_wrap() or facet_grid(). ncol
and nrow
are used as layout indices for lattice (for homology with facet_wrap). Also merged with ....
numeric (will be recycled to length 4) giving plot margins in default units: top, right, bottom, left (in multiples of 5.5 points for ggplot)
default shared by xref.col
and yref.col
; can be length one integer to auto-select that many colors
default shared by xref.lty
and yref.lty
default shared by xref.lwd
and yref.lwd
default shared by xref.alpha
and yref.alpha
x reference line color (recycled)
x reference line type (recycled)
x reference line size (recycled)
x reference line alpha (recycled)
y reference line color (recycled)
y reference line type (recycled)
y reference line size (recycled)
y reference line alpha (recycled)
smooth line type
smooth line size
smooth alpha
draw a linear fit of y ~ x
fit line type
fit line size
fit alpha
logical, or width for a confidence region around a linear fit; passed to region
; TRUE
defaults to 95 percent confidence interval; may not make sense if xlog is TRUE
alpha transparency for confidence region
where to print statistics on a panel; suppressed for grouped plots an facetted ggplots
if TRUE, xsmooth, ysmooth, fit, and conf are applied to all data rather than groupwise
color for global aesthetics
fill color for global aesthetics
a function to print text on a panel: called with x values, y values, and ....
logical: whether to generate ggplot
instead of trellis
generate messages describing process
passed to called functions e.g., region
scatter_panel
Other bivariate plots:
iso_prepanel()
,
metaplot.data.frame()
,
scatter.data.frame()
,
scatter()
Other metaplot:
boxplot_data_frame()
,
categorical_data_frame()
,
corsplom_data_frame()
,
densplot_data_frame()
,
metaplot_key()
,
metaplot()
,
test_metaplot()
Other scatter:
metaplot_key()
,
scatter.data.frame()
,
scatter_panel()
,
scatter()
library(magrittr)
library(dplyr)
attr(Theoph$conc,'label') <- 'theophylline concentration'
attr(Theoph$conc,'guide') <- 'mg/L'
attr(Theoph$Time,'label') <- 'time'
attr(Theoph$Time,'guide') <- 'h'
attr(Theoph$Subject,'guide') <- '////'
scatter_data_frame(Theoph, 'conc', 'Time')
scatter_data_frame(Theoph, 'conc','Time', 'Subject')
scatter_data_frame(Theoph, 'conc','Time', facets = 'Subject')
scatter_data_frame(Theoph %>% filter(conc > 0), 'conc','Time', 'Subject',ylog = TRUE, yref = 5)
scatter_data_frame(Theoph, 'conc','Time', 'Subject',ylog = TRUE, yref = 5)
scatter_data_frame(Theoph, 'conc','Time', 'Subject',ysmooth = TRUE)
scatter_data_frame(Theoph, 'conc','Time', 'Subject',ysmooth = TRUE,global = TRUE)
scatter_data_frame(Theoph, 'conc','Time', conf = TRUE, loc = 3, yref = 6)
scatter_data_frame(Theoph, 'conc','Time', conf = TRUE, loc = 3, yref = 6)
Run the code above in your browser using DataLab