stat_gof2 | R Documentation |
stat_gof2
stat_gof2(
mapping = NULL,
data = NULL,
geom = GeomRichTextNpc,
position = "identity",
na.rm = FALSE,
show.legend = NA,
show.bias = TRUE,
label.format = fmt_gof,
x = 0.05,
y = 0.95,
inherit.aes = TRUE,
...
)
geom_gof2(
mapping = NULL,
data = NULL,
stat = StatGOF2,
position = "identity",
...,
show.bias = TRUE,
label.format = fmt_gof,
x = 0,
y = 1,
hjust = 0,
vjust = 1,
size = 5,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
position |
Position adjustment, either as a string, or the result of
a call to a position adjustment function. Cannot be jointy specified with
|
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
label.format |
default value:
|
x |
A numeric vector or unit object specifying x-values. |
y |
A numeric vector or unit object specifying y-values. |
inherit.aes |
If |
... |
Other arguments passed on to |
stat |
The statistical transformation to use on the data for this layer, as a string. |
No return. This function is used to calculate data for gglot2
geom_*
, just like ggplot2::stat_smooth()
.
obs
: observed
sim
: simulated
library(ggplot2)
library(data.table)
dates <- seq(as.Date("2010-01-01"), length.out = 32, by = "day")
dat <- data.table(mtcars) %>% cbind(date = dates, .)
dat$cyl <- as.factor(dat$cyl)
# table(dat$cyl)
ggplot(dat, aes(date, mpg, color = cyl)) +
stat_gof2(aes(obs = mpg, sim = wt), x = 0, y = 1) +
geom_point() +
facet_wrap(~cyl)
## Example 2
dat = GPP_US_MMS
ggplot(dat, aes(date, GPP)) +
geom_line() +
stat_gof2(aes(obs=GPP, sim=SM),x = 0, y = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.