GithubHelp home page GithubHelp logo

ir-sfsu / d3rain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daranzolin/d3rain

0.0 1.0 0.0 3.46 MB

An htmlwidget bringing D3 drip to R :sweat_drops: :sparkles: :bar_chart:

License: Other

R 96.12% CSS 3.88%

d3rain's Introduction

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

d3rain's People

Contributors

daranzolin avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.