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

plot.prcalc_index_compareR Documentation

Visualization of a prcalc_index_compare object.

Description

Visualization of a prcalc_index_compare object.

Usage

## S3 method for class 'prcalc_index_compare'
plot(
  x,
  index = NULL,
  style = "bar",
  bar_width = 0.75,
  point_size = 5,
  facet = FALSE,
  free_x = TRUE,
  font_size = 12,
  facet_col = 4,
  legend_pos = "bottom",
  ...
)

Arguments

x

a prcalc_index_compare object.

index

a character vector of disproportionality indices. If NULL, all indices are displayed.

style

Plot style. Lollipop (⁠"lollipop⁠) or bar plot ("bar"). Default is "bar".

bar_width

Default is 0.75.

point_size

Default is 5.

facet

Separate facets by indices? Default is FALSE.

free_x

Default is TRUE.

font_size

a font size. Default is 12.

facet_col

a number of columns of facets. Default is 4.

legend_pos

a position of legend. Default is "bottom"

...

Ignored

Value

A ggplot object.

Examples

data(jp_upper_2019)

pr_obj1 <- prcalc(jp_upper_2019, m = 50, method = "dt")
pr_obj2 <- prcalc(jp_upper_2019, m = 50, method = "dt", threshold = 0.025)
pr_obj3 <- prcalc(jp_upper_2019, m = 50, method = "dt", threshold = 0.05)

list("t = 0%"   = index(pr_obj1),
     "t = 2.5%" = index(pr_obj2),
     "t = 5%"   = index(pr_obj3)) |>
  compare() |>
  plot()

list("t = 0%"   = index(pr_obj1),
     "t = 2.5%" = index(pr_obj2),
     "t = 5%"   = index(pr_obj3)) |>
  compare() |>
  plot(index = c("lh", "gallagher", "rae", "dhondt", "ad"))

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