Create a scatter plot between two quantitative variables.
scatter(
data,
x,
y,
outlier = 3,
alpha = 1,
digits = 3,
title,
margin = "none",
stats = TRUE,
point_color = "deepskyblue2",
outlier_color = "violetred1",
line_color = "grey30",
margin_color = "deepskyblue2"
)
data frame
quantitative predictor variable
quantitative response variable
number. Observations with studentized residuals larger than this value are flagged. If set to 0, observations are not flagged.
Transparency of data points. A numeric value between 0 (completely transparent) and 1 (completely opaque).
Number of significant digits in displayed statistics.
Optional title.
Marginal plots. If specified, parameter can be
histogram
, boxplot
, violin
,
or density
. Will add these
features to the top and right margin of the graph.
logical. If TRUE
, the slope,
correlation, and correlation squared (expressed as a percentage) for the
regression line are printed on the subtitle line.
Color used for points.
Color used to identify outliers (see the outlier
parameter.
Color for regression line.
Fill color for margin boxplots, density plots, or histograms.
a ggplot2 graph
The scatter
function generates a scatterplot between two quantitative
variables, along with a line of best fit and a 95% confidence interval.
By default, regression statistics (b, r, r2, p) are printed and
outliers (observations with studentized residuals > 3) are flagged.
Optionally, variable distributions (histograms, boxplots, violin plots,
density plots) can be added to the plot margins.
Variable names do not have to be quoted.