| plot.multilpa | R Documentation |
Draws one view of a fit as a ggplot object, which can be printed, saved
with ggplot2::ggsave() or styled further with + ggplot2::theme().
Every view shares one profile order (largest first), one profile share (the
posterior share every table reports) and one set of Okabe-Ito colours
paired with point shapes, so a profile looks the same in every view.
Series are labelled directly rather than through a legend.
## S3 method for class 'multilpa'
plot(
x,
what = c("profiles", "bars", "heatmap", "raincloud", "parallel", "pairs", "responses",
"probabilities", "sequences", "sizes", "entropy", "posteriors", "avepp", "all"),
data = NULL,
scale = c("raw", "standardized"),
category = "last",
labels = TRUE,
intervals = TRUE,
cell_labels = TRUE,
main = NULL,
subtitle = NULL,
...
)
x |
A fitted |
what |
Which view to draw. The measurement model: The two-level structure: Classification:
|
data |
Optional. The data frame the model was fitted to. A fit carries the columns it was built from, so intervals are drawn without it; pass it only to compute them from a different frame. |
scale |
For the mean views and |
category |
For |
labels |
|
intervals |
For |
cell_labels |
For |
main, subtitle |
Title and subtitle. |
... |
Nothing further is accepted; an unknown argument raises an error
of class |
The plots need the ggplot2 package, which latents suggests rather than
requires; without it a plot is refused with an error of class
latents_missing_package.
"profiles" and "bars" draw 95% Wald intervals when the fit has
standard errors. Profile numbers are arbitrary, so two fits must have
their labels aligned before their plots are compared. With
scale = "standardized" the standard deviations are the observed
indicator standard deviations, not the within-profile ones, so the values
are comparable across indicators but are not effect sizes.
A ggplot object; for what = "all", a latents_plots list of them,
named by view, that draws every one when printed.
latents_missing_package without ggplot2;
latents_no_continuous, latents_no_categorical, latents_no_time and
latents_nothing_to_plot when the fit lacks what a view needs;
latents_bad_argument for an argument the method does not use.
Zappia, L. and Oshlack, A. (2018). Clustering trees: a visualization for evaluating clusterings at multiple resolutions. GigaScience, 7(7), giy083.
plot_views() for the catalogue of views.
if (requireNamespace("ggplot2", quietly = TRUE)) {
set.seed(7)
example_data <- data.frame(
school = rep(seq_len(12), each = 10),
score_a = rnorm(120), score_b = rnorm(120)
)
fit <- multilpa(example_data, c("score_a", "score_b"), "school",
n_profiles = 2, n_group_classes = 1, n_starts = 2)
plot(fit)
plot(fit, scale = "standardized")
plot(fit, what = "bars")
plot(fit, what = "pairs")
plot(fit, what = "avepp")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.