Skip to content
/ d3rain Public
forked from daranzolin/d3rain

An htmlwidget bringing D3 drip to R 💦 ✨ 📊

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

ir-sfsu/d3rain

 
 

Repository files navigation

d3rain

Travis build status

According to the authorities at Urban Dictionary, ‘drip’ is synonymous with ‘immense swag.’ This package brings some D3 drip to R.

Installation

You can install d3rain from GitHub via:

remotes::install_github("daranzolin/d3rain")

Example

‘Rain’ visualizations are useful aids to observe the relationship between a ranked, numeric variable (e.g. percentile, rank, etc.) and any factored, categorical variable.

library(d3rain)
library(tidyverse)

armed_levels <- c('No', 'Knife', 'Non-lethal firearm', 'Firearm')
pk <- fivethirtyeight::police_killings %>% 
  filter(armed %in% armed_levels,
         !is.na(age)) %>% 
  mutate(armed = factor(armed, levels = armed_levels)) 

pk %>% 
  d3rain(age, armed, toolTip = raceethnicity, title = "2015 Police Killings by Age, Armed Status") %>% 
  drip_behavior(dripSequence = 'iterate',
                ease = 'bounce',
                jitterWidth = 20,
                dripSpeed = 1000) %>% 
  drip_style(dripFill = 'firebrick',
             fontFamily = 'times')

Alt Text

drip_behavior adjusts the drip sequence, easing animation, jitter width, and drip speed. drip_style controls the drip fill, font size, font family, and background color.

Future Work

  • Additional drip behaviors (e.g. by group)
  • Conditional fill colors
  • More axis control

About

An htmlwidget bringing D3 drip to R 💦 ✨ 📊

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 96.1%
  • CSS 3.9%