All Projects โ†’ leeper โ†’ Slopegraph

leeper / Slopegraph

Edward Tufte-Inspired Slopegraphs

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Slopegraph

Ggpage
Creates Page Layout Visualizations in R ๐Ÿ“„๐Ÿ“„๐Ÿ“„
Stars: โœญ 306 (+84.34%)
Mutual labels:  ggplot2, data-visualization, dataviz
Esquisse
RStudio add-in to make plots with ggplot2
Stars: โœญ 1,097 (+560.84%)
Mutual labels:  ggplot2, data-visualization
Leaflet Swoopy
โคต๏ธ Swoopy Arrow Plugin for Leaflet
Stars: โœญ 52 (-68.67%)
Mutual labels:  data-visualization, dataviz
Plotly
An interactive graphing library for R
Stars: โœญ 2,096 (+1162.65%)
Mutual labels:  ggplot2, data-visualization
Ggrepel
๐Ÿ“ Repel overlapping text labels away from each other.
Stars: โœญ 853 (+413.86%)
Mutual labels:  ggplot2, cran
Ggplot Courses
๐Ÿ‘จโ€๐Ÿซ ggplot2 Teaching Material
Stars: โœญ 40 (-75.9%)
Mutual labels:  ggplot2, dataviz
Ggpol
๐ŸŒ Parliament diagrams and more for ggplot2
Stars: โœญ 71 (-57.23%)
Mutual labels:  ggplot2, dataviz
Ggthemr
Themes for ggplot2.
Stars: โœญ 697 (+319.88%)
Mutual labels:  ggplot2, data-visualization
Dex
Dex : The Data Explorer -- A data visualization tool written in Java/Groovy/JavaFX capable of powerful ETL and publishing web visualizations.
Stars: โœญ 1,238 (+645.78%)
Mutual labels:  data-visualization, dataviz
Ggplotnim
A port of ggplot2 for Nim
Stars: โœญ 95 (-42.77%)
Mutual labels:  ggplot2, data-visualization
Imputets
CRAN R Package: Time Series Missing Value Imputation
Stars: โœญ 114 (-31.33%)
Mutual labels:  cran, data-visualization
Amcharts4
The most advanced amCharts charting library for JavaScript and TypeScript apps.
Stars: โœญ 907 (+446.39%)
Mutual labels:  data-visualization, dataviz
Hrbrthemes
๐Ÿ” Opinionated, typographic-centric ggplot2 themes and theme components
Stars: โœญ 899 (+441.57%)
Mutual labels:  ggplot2, data-visualization
Soccergraphr
Soccer Analytics in R using OPTA data
Stars: โœญ 42 (-74.7%)
Mutual labels:  ggplot2, data-visualization
Explorer
Data Explorer by Keen - point-and-click interface for analyzing and visualizing event data.
Stars: โœญ 725 (+336.75%)
Mutual labels:  data-visualization, dataviz
Reaviz
๐Ÿ“Š Data visualization library for React based on D3
Stars: โœญ 1,141 (+587.35%)
Mutual labels:  data-visualization, dataviz
Kravis
A {K}otlin g{ra}mmar for data {vis}ualization
Stars: โœญ 134 (-19.28%)
Mutual labels:  ggplot2, data-visualization
Heatmap.js
๐Ÿ”ฅ JavaScript Library for HTML5 canvas based heatmaps
Stars: โœญ 5,685 (+3324.7%)
Mutual labels:  data-visualization, dataviz
Leaflet Dvf
Leaflet Data Visualization Framework
Stars: โœญ 678 (+308.43%)
Mutual labels:  data-visualization, dataviz
React Fusioncharts Component
ReactJS component for FusionCharts JavaScript Charting library.
Stars: โœญ 73 (-56.02%)
Mutual labels:  data-visualization, dataviz

Tufte-Inspired Slopegraphs in R

This repository holds some working code for creating "slopegraphs" in R.

This is very much a work in progress. Once it's more stable, I will release the package to CRAN.

Pull requests welcome. Please report any issues on the issues page.

The package currently includes one mainfunction, slopegraph(), which produces a slopegraph from an observation-by-period data frame. Everything is more or less drawn automatically, but is highly customizable in terms of line and text colors, font sizes and styles, axes, titles, and plotting behind and in front of the slopegraph lines. An underlying function, segmentize() produces the data structure used for the actual plotting. And a new function, ggslopegraph() does the same as slopegraph() but using ggplot2 graphics.

Examples

The current output of the slopegraph() function (for the examples included in documentation) are shown below.

Tufte's most famous slopegraph example is probably the "cancer survival graph," depicting 5, 10, 15, and 20 year survival rates for various cancers. The first example mimics this result but draws it to the correct scale (unlike Tufte's original):

library("slopegraph")
data(cancer)
slopegraph(cancer, col.lines = 'gray', col.lab = "black", 
           xlim = c(-.5,5.5), cex.lab = 0.5, cex.num = 0.5,
           xlabels = c('5 Year','10 Year','15 Year','20 Year'))

Cancer Survival

The second example, also from Tufte, shows changes in gross domestic product for a small set of countries over two points in time:

data(gdp)
slopegraph(gdp, col.lines = 'gray', col.lab = "black", xlabels = c('1970','1979'),  
           main = 'Current Receipts of Goverment as a Percentage of Gross Domestic Product')

GDP

This third example comes from an 1878 publication (a copy of which is available here), showing the relative ranking of the population of various U.S. states. This example features a reversed y-axis to better display the ranking and I demonstrate the col.lines argument to highlight South Carolina:

data(states)
cols <- `[<-`(rep("black", 37), 7, "red")
slopegraph(states, xlim = c(-1, 12), ylim = c(37,0), offset.x = 0.06,
           col.lines = cols, col.lab = cols, 
           main = 'Relative Rank of U.S. State Populations, 1790-1870')

states

As of v0.1.9, there is also a ggplot2-based function, ggslopegraph() that produces a similar representation but using ggplot2 graphics:

require("ggplot2")
## Loading required package: ggplot2
data(states)
cols <- `[<-`(rep("black", 37), 7, "red")
ggslopegraph(states, offset.x = 0.06, yrev = TRUE,
  col.lines = cols, col.lab = cols, 
  main = 'Relative Rank of U.S. State Populations, 1790-1870') +
 theme_bw()    
## Warning: Removed 84 rows containing missing values (geom_text).

ggstates

Installation

CRAN Build Status Build status codecov.io Project Status: Work in Progress

To install the latest development version of slopegraph from GitHub:

if (!require("remotes")) {
    install.packages("remotes")
}
remotes::install_github("leeper/slopegraph")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].