Skip to contents

Creates lines showing range by category, with dot endpoints credit https://uc-r.github.io/cleveland-dot-plots

Usage

cleveland_dot_chart(
  t,
  x,
  y,
  fill,
  est = NULL,
  dec = 0,
  dform = "%b-%Y",
  lwidth = 1.5,
  dotsize = 3,
  color = "gnbopgy_5",
  shape = "circle",
  title = NULL,
  subtitle = NULL,
  source = "",
  alt = NULL,
  xlabel = NULL,
  ylabel = NULL
)

Arguments

t

A tibble or dataframe in long form for plotting

x

The name of the variable you want plotted on the X-Axis (numeric)

y

The name of the variable you want plotted on the Y-Axis (categorical)

fill

The name of the variable supplying line endpoints (e.g. time points)

est

Type for the numeric values - enter "percent", "currency" or "number", defaults to "percent"

dec

Number of decimal points in labels - defaults to 0

dform

Format for Date values

lwidth

Width of lines; defaults to 1.5

dotsize

Defaults to 3

color

Name of color palette to use - generally defaults to "pgnobgy_5"

shape

Of dot and legend; can be either value 1:25 or name; defaults to "circle" see https://ggplot2.tidyverse.org/articles/ggplot2-specs.html?q=shapes#sec:shape-spec

title

Title to be used for chart, if desired - defaults to "NULL"

subtitle

Sub-title to be used for chart, if desired - defaults to "NULL"

source

Source reference as character string, if desired - defaults to blank

alt

Text to be used for alt-text, if desired - defaults to "NULL"

xlabel

category-axis title to be used for chart, if desired - defaults to "NULL"

ylabel

numeric-axis title to be used for chart, if desired - defaults to "NULL"

Value

A Cleveland line chart

Author

Michael Jensen