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 = color("light_blue_grey"),
  group_x_title = NULL,
  group_y_title = NULL,
  x_title = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  line_to_y_axis = FALSE,
  line_to_y_axis_type = 3,
  line_to_y_axis_width = 0.5,
  line_to_y_axis_color = color("dark_grey"),
  add_text = FALSE,
  add_text_vjust = 2,
  add_text_size = 3.5,
  add_text_color = color("dark_grey"),
  theme_fun = theme_dumbbell(),
  scale_fill_fun = scale_fill_visualizer_discrete(),
  scale_color_fun = scale_color_visualizer_discrete()
)

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_fun

A ggplot2 theme, default to `theme_dumbbell()`

scale_fill_fun

A ggplot2 scale_fill function, default to `scale_fill_visualizer_discrete()`

scale_color_fun

A ggplot2 scale_color function, default to `scale_color_visualizer_discrete()`

Value

A dumbbell chart.