Skip to contents

This function creates publication-ready plots based on the output from `projoint()`. It supports both profile-level and choice-level analyses, with tailored plotting options.

Usage

# 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),
  ...
)

Arguments

x

A `projoint_results` object, typically created by `projoint()`.

.estimates

Character. Which estimates to plot: `"corrected"` (default), `"uncorrected"`, or `"both"`.

.by_var

Logical. (Profile-level only) Whether to plot subgroup differences. Default is `FALSE`.

.labels

Character vector. (Choice-level only) Custom x-axis labels for bar or point-range plots.

.base_size

Numeric. Base font size for plot text. Default is 12.

.base_family

Character. Base font family for plot text. Default is "" (system default).

.type

Character. (Choice-level only) Type of plot: `"bar"` (default) or `"pointrange"`.

.show_attribute

Logical. (Choice-level only) Whether to display the attribute name as a plot title. Default is `FALSE`.

.remove_xaxis

Logical. (Choice-level only) Whether to remove x-axis labels and ticks. Default is `FALSE`.

.xlim

Numeric vector of length 2. (Choice-level only) X-axis limits. Default is `c(0, 1)`.

.plot.margin

Numeric vector of length 4. (Choice-level only) Margins around the plot in centimeters. Default is `c(0, 3, 0, 3)`.

...

Additional arguments passed to underlying plotting functions.

Value

A `ggplot2` object.

Details

For **profile-level results**, only `.by_var`, `.base_size`, and `.base_family` are relevant.

For **choice-level results**, only `.type`, `.labels`, `.show_attribute`, `.xtitle`, `.remove_xaxis`, `.xlim`, `.hjust_left`, `.hjust_right`, `.title_size`, and `.plot.margin` are relevant.

If irrelevant arguments are provided for a given structure, a warning will be issued and the arguments will be ignored.

See also

[projoint()], [projoint_results], [plot_projoint_profile_level()], [plot_projoint_choice_level_mm()]