View source: R/simplex_plotting.R
plot_density_ternary | R Documentation |
Plot data density on a ternary plot.
plot_density_ternary( data, groups = NULL, parts_to_plot = NULL, n_bins = 5, 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). |
n_bins |
Number of bins to use on density plot. |
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 density of data on ternary plot.
simdata$activity <- simdata$vigorous + simdata$moderate + simdata$light plot_density_ternary(data = simdata, parts_to_plot = c("activity", "sedentary", "sleep"), n_bins = 10 # This argument specifies we want to use 10 bins # (i.e. 9 equi-density contours will be plotted between the minimum and maximum # probability density.) Default is n_bins = 5. )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.