Skip to content

bshor/ggslopegraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

634 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggslopegraph

ggslopegraph is a small extraction of CGPfunctions::newggslopegraph() as a standalone function for drawing Tufte-style slopegraphs with ggplot2.

Installation

install.packages("pak")
pak::pak("bshor/ggslopegraph")

Example

library(ggslopegraph)

example <- data.frame(
  year = ordered(
    rep(c("2020", "2022", "2024"), 3),
    levels = c("2020", "2022", "2024")
  ),
  value = c(10, 12, 14, 8, 8, 7, 15, 16, 18),
  group = rep(c("A", "B", "C"), each = 3)
)

ggslopegraph(
  dataframe = example,
  Times = year,
  Measurement = value,
  Grouping = group,
  Title = "Example slopegraph",
  SubTitle = NULL,
  Caption = NULL
)

Credits

This package traces back to Thomas J. Leeper's slopegraph package. The current function is adapted from Chuck Powell's CGPfunctions::newggslopegraph().

About

Tufte-style slopegraphs with ggplot2

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • R 100.0%