plot.prcalc_decomposition_compare: Visualization of a 'prcalc_decomposition_compare' object.

plot.prcalc_decomposition_compareR Documentation

Visualization of a prcalc_decomposition_compare object.

Description

Visualization of a prcalc_decomposition_compare object.

Usage

## S3 method for class 'prcalc_decomposition_compare'
plot(
  x,
  percentage = FALSE,
  facet = FALSE,
  bar_width = 0.75,
  value_type = "all",
  value_angle = 0,
  value_size = 3,
  x_angle = 0,
  font_size = 12,
  border_width = 0,
  border_color = "black",
  digits = 3,
  ...
)

Arguments

x

a prcalc_decomposition_compare object.

percentage

If TRUE, the percentage of each element is displayed. If facet = TRUE, it is ignored.

facet

Default is FALSE.

bar_width

Default is 0.75.

value_type

"all", "total", or "none". If "total", only alpha-divergences are displayed. Default is "all".

value_angle

Angle of values. Default is 0.

value_size

Default is 3. If value_type == "none", it is ignored.

x_angle

an angle of x-ticks label (0 to 90). Defualt is 0.

font_size

a font size. Default is 12.

border_width

width of border. Default is 0 (no border).

border_color

color of border. Default is "black".

digits

Default is 3.

...

Ignored

Value

A ggplot object.

Examples

data(jp_lower_2021)

obj1 <- prcalc(jp_lower_2021,
               m = c(8, 13, 19, 22, 17, 11, 21, 28, 11, 6, 20),
               method = "dt")

obj2 <- prcalc(jp_lower_2021,
               m = c(8, 13, 19, 22, 17, 11, 21, 28, 11, 6, 20),
               method = "hare")

obj3 <- prcalc(jp_lower_2021,
               m = c(8, 13, 19, 22, 17, 11, 21, 28, 11, 6, 20),
               method = "msl")

obj4 <- prcalc(jp_lower_2021,
               m = c(8, 13, 19, 23, 19, 11, 20, 29, 10, 5, 19),
               method = "dt")

obj5 <- prcalc(jp_lower_2021,
               m = c(8, 13, 19, 23, 19, 11, 20, 29, 10, 5, 19),
               method = "msl")

compare(list("D'Hondt"     = decompose(obj1),
             "Hare"        = decompose(obj2),
             "Modified-SL" = decompose(obj3))) |>
  plot()

compare(list("Model 1" = decompose(obj1),
             "Model 2" = decompose(obj4),
             "Model 3" = decompose(obj5))) |>
  plot(facet = TRUE, value_type = "total", digits = 5)

JaehyunSong/PRcalc documentation built on April 17, 2024, 1:23 p.m.