Description Usage Arguments Computed variables Examples
View source: R/stat_normal_density.R
A ggplot2 layer that fits and plots a theoretical normal density function. May be used to visually compare between empirical and theoretical normal distributions.
1 2 3 4 5 6 7 8 9 10 11 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use display the data |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
trim |
(numeric) Fraction of points to trim before computing mean and
standard deviation, which are used to construct
theoretical normal distribution.
Number between 0 and 1. Default is |
... |
Other arguments passed on to |
normal density
normal density scaled to maximum of 1
normal density * number of points
1 2 3 4 5 6 7 8 9 | library(ggplot2)
library(biostat)
ggplot(mtcars, aes(mpg)) +
stat_normal_density()
ggplot(mtcars, aes(mpg)) +
stat_density(alpha = 0.8) +
stat_normal_density(color = "red", size = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.