Skip to contents

Make dumbbell chart.

Usage

dumbbell(
  df,
  col,
  group_x,
  group_y,
  point_size = 5,
  point_alpha = 1,
  segment_size = 2.5,
  segment_color = cols_reach("main_lt_grey"),
  group_x_title = NULL,
  group_y_title = NULL,
  x_title = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  line_to_y_axis = TRUE,
  line_to_y_axis_type = 3,
  line_to_y_axis_width = 0.5,
  line_to_y_axis_color = cols_reach("main_grey"),
  add_text = TRUE,
  add_text_vjust = 2,
  add_text_size = 3.5,
  add_text_color = cols_reach("main_grey"),
  theme = theme_reach(palette = "primary")
)

Arguments

df

A data frame.

col

A numeric column.

group_x

The grouping column on the x-axis; only two groups.

group_y

The grouping column on the y-axis.

point_size

Point size.

point_alpha

Point alpha.

segment_size

Segment size.

segment_color

Segment color.

group_x_title

X-group and legend title.

group_y_title

Y-axis and group title.

x_title

X-axis title.

title

Title.

subtitle

Subtitle.

caption

Caption.

line_to_y_axis

TRUE or FALSE; add a line connected points and Y-axis.

line_to_y_axis_type

Line to Y-axis type.

line_to_y_axis_width

Line to Y-axis width.

line_to_y_axis_color

Line to Y-axis color.

add_text

TRUE or FALSE; add text at the points.

add_text_vjust

Vertical adjustment.

add_text_size

Text size.

add_text_color

Text color.

theme

A ggplot2 theme, default to `theme_reach()`

Value

A dumbbell chart.