View source: R/simplex_plotting.R
plot_prediction_region_ternary | R Documentation |
Plot prediction regions. Please note these wrap the 'ggtern' function 'geom_confidence_region' but are actually prediction regions (or predictive confidence regions): regions in which a future data point is expected to fall with the given probability (rather than a confidence region for a particular statistic).
plot_prediction_region_ternary( data, groups = NULL, parts_to_plot = NULL, probs = c(0.5, 0.9, 0.95), mark_points = NULL, theme = NULL, transparency = 0.2, suppress_legend = FALSE )
data |
Data frame containing data to be plotted. |
groups |
If plotting groups separately, name of the variable in the data frame which identifies the groups to be plotted. This variable should be a factor variable. |
parts_to_plot |
Names of the three variables in the data frame which are to be plotted on the ternary plot. Note they should be on the same scale (they don't need to be normalised to 1). |
probs |
Sequence of probabilities to plot prediction regions for. |
mark_points |
Points should be the rows of a data frame with the elements of |
theme |
Optional |
transparency |
Control the transparency of plots. Should be between 0 and 1. |
suppress_legend |
Suppress legend on plot. May be used when combining plots. |
This is a wrapper for ggtern
.
Plot showing prediction regions for data on ternary plot.
simdata$activity <- simdata$vigorous + simdata$moderate + simdata$light plot_prediction_region_ternary(data = simdata, parts_to_plot = c("activity", "sedentary", "sleep"), probs = c(0.25, 0.5, 0.75) # This argument specifies # we want to plot 25%, 50% and 75% prediction regions. )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.