Jason Hilton 14 November, 2017
This package is a ggplot-based implementation of some of the functionality of the
fanplot package by Guy Abel. Fanplot provides methods to visualise probability distributions by representing intervals of the distribution function with colours. Plotting samples from posterior distributions obtained through MCMC is a particular aim. A ggplot-based implementation is useful as it allows leverage of the power of ggplot2 features allowing, for example, facetting and easy theming.
The package has recently been submitted to CRAN. Installation directly from CRAN will be possible if and when the package is accepted:
install.packages("ggfan") Otherwise, the package can be installed directly from github using the devtools package:
fake_df data gives and example of the type of data you might want to plot with ggfan: it consists of 1000 samples of an outcome variable of interest at each value of a covariate
x. We can plot this simply using standard
ggplot2 syntax and
ggplot features such as themes, colour scales and facetting can also be used.
ggplot(fake_df, aes(x=x, y=y)) + geom_fan() + theme_minimal() + scale_fill_distiller(palette="Spectral")
A full description of the functionality of
ggfan is provided in the vignette, provided here.
A brief example of using
ggfan to plot
stan output is given in a second vignette here