View source: R/plot.projoint_results.R
| plot.projoint_results | R Documentation |
projoint_resultsCreates publication-ready plots from a projoint_results object produced by
projoint. Supports both profile-level and choice-level analyses,
with plotting options tailored to each structure.
## S3 method for class 'projoint_results'
plot(
x,
.estimates = "corrected",
.by_var = FALSE,
.labels = NULL,
.base_size = 12,
.base_family = "",
.type = c("bar", "pointrange"),
.show_attribute = TRUE,
.remove_xaxis = FALSE,
.xlim = c(0, 1),
.plot.margin = c(0, 3, 0, 3),
...
)
x |
A |
.estimates |
Character: which estimates to plot. One of
|
.by_var |
Logical (profile-level only). Whether to plot subgroup differences.
Default |
.labels |
Character vector of length 2 (choice-level only). Custom x-axis
labels for bar/pointrange plots. If |
.base_size |
Numeric. Base font size. Default |
.base_family |
Character. Base font family. Default |
.type |
Character (choice-level only). One of |
.show_attribute |
Logical (choice-level only). Show the attribute name as the
title when both levels belong to the same attribute. Default |
.remove_xaxis |
Logical (choice-level only). Remove x-axis line, ticks, and labels.
Default |
.xlim |
Numeric length-2 vector (choice-level only). X-axis limits. Default |
.plot.margin |
Numeric length-4 vector (choice-level only). Plot margins in cm:
|
... |
Additional arguments passed to downstream plotting helpers. |
For profile-level results, only .by_var, .base_size, and .base_family
are relevant. For choice-level results, only .type, .labels,
.show_attribute, .remove_xaxis, .xlim, and .plot.margin
are relevant. Irrelevant arguments are ignored with a warning.
A ggplot2 object.
projoint, plot_projoint_profile_level,
plot_projoint_choice_level_mm
data(exampleData1)
# Two base tasks (1 & 2) + repeated of task 1 (last)
dat <- reshape_projoint(
exampleData1,
.outcomes = c("choice1", "choice2", "choice1_repeated_flipped")
)
# Build a valid QOI from the labels
att <- unique(dat$labels$attribute_id)[1]
levs <- subset(dat$labels, attribute_id == att)$level_id
lev_names <- sub(".*:", "", levs)
q <- set_qoi(
.structure = "choice_level",
.estimand = "mm",
.att_choose = att,
.lev_choose = lev_names[2],
.att_notchoose = att,
.lev_notchoose = lev_names[1]
)
fit <- projoint(dat, .qoi = q)
# Plot method
plot(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.