| ggplot.sma | R Documentation |
Produce a ggplot2 version of the default x-y
plot for an sma fit: the data points plus the fitted (standardised)
major axis line(s), with separate colours for each group where present. This
is a ggplot2-based alternative to the base-graphics plot.sma.
## S3 method for class 'sma'
ggplot(data = NULL, mapping = aes(), ..., environment = parent.frame())
data |
An object of class |
mapping, environment |
Present for consistency with the
|
... |
Further arguments passed to |
Data and fitted lines are drawn on the natural (back-transformed)
scale of the original variables. Where the fit used a log transformation
(log was one of "x", "y" or "xy"), the
corresponding axis is drawn on a log10 scale via
scale_x_log10 / scale_y_log10.
The fitted line geometry mirrors the curve logic used by
plot.sma, so both plotting methods agree.
The returned object is a standard ggplot object and can be further
customised with additional layers, themes, scales and facets in the usual
way.
A ggplot object.
F. Kar, D. Falster
plot.sma
## Not run:
data(leaflife)
leaf.low.soilp <- subset(leaflife, soilp == "low")
# Single fit
ft1 <- sma(longev ~ lma, data = leaf.low.soilp, log = "xy")
ggplot2::ggplot(ft1)
# Grouped fit with common-slope test
ft2 <- sma(longev ~ lma * rain, data = leaf.low.soilp, log = "xy")
ggplot2::ggplot(ft2)
# ggplot object can be extended as usual
ggplot2::ggplot(ft2) + ggplot2::theme_minimal()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.