View source: R/fit_and_reporting.R
umxPlot | R Documentation |
Want a figure for your paper or presentation but not the work of combining ggplot2::ggplot()
,
ggplot2::geom_smooth()
and method
options, plus ggplot2::geom_point()
. Organizing ggplot2::labs()
and its
x
, y
, and title
components. Adding your preferred theme like ggplot2::theme_gray()
, plus recalling
for cowplot::draw_label()
, and/or ggplot2::annotate()
to draw math-enabled labels on the plot, as well
as the required bquote()
, and extracting the relevant fit statistics from lm()
and the subsidiary tasks
of reformulate()
programmatic variables?
umxPlot
just takes y ~ x
(or "x" and "y" as strings), and gives you a nicely labelled plot, with a fitted line, the
R2 so readers can see how well this fitted. It knows how to put Greek symbols like beta
into axes.
umxPlot(
x,
y = NULL,
data,
xlab = x,
ylab = y,
title = paste0(y, " as a function of ", x),
fitx = NA,
fity = NA,
geom_point = TRUE,
method = c("lm", "auto", "loess", "glm", "gam"),
family = c("gaussian", "binomial", "Gamma", "inverse", "poisson", "quasi",
"quasibinomial", "quasipoisson")
)
x |
formula or (alternatively) x as string |
y |
variable as string. |
data |
The data for the graph. |
xlab |
X-axis label (default y). |
ylab |
Y-axis label (default y). |
title |
Graph title. Default = paste0(y, " as a function of ", x) |
fitx |
x location for the fit summary (default 1). |
fity |
y location for the fit summary (default 2). |
geom_point |
show points? (TRUE) |
method |
Method for fitting curve (default = lm) |
family |
for glm default = "gaussian" |
plot you can edit.
ggplot2::qplot()
Other Plotting functions:
ggAddR()
,
plot.MxLISRELModel()
,
plot.MxModel()
,
plot.MxModelTwinMaker()
,
umx
,
umxPlotACE()
,
umxPlotACEcov()
,
umxPlotACEv()
,
umxPlotCP()
,
umxPlotDoC()
,
umxPlotFun()
,
umxPlotGxE()
,
umxPlotGxEbiv()
,
umxPlotIP()
,
umxPlotSexLim()
,
umxPlotSimplex()
data(mtcars)
umxPlot(mpg ~ wt, data = mtcars, fitx = 2, fity = 10)
umxPlot(x = "wt", y = "mpg", mtcars, fitx = 2, fity = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.