Skip to content

chengvt/MovingBubbles

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 

MovingBubbles : Animated d3 bubble chart

The package provides a method to add the second information dimension, which can be either qualitative or quantitative, to the bubble chart by means of animation. The plotting and transitions between frames are handled by d3 library. The package uses htmlwidgets framework to bridge Javascript and R.

Usage & Demo

The function takes in a data.frame with key, value, and frame columns. Optional data.frame with key and color (hex) can be given to specify the bubble color. The frame column will be factorized if not already and the order of factor levels will be used to run the animation sequentially. Thus, the sequence can be defined by manually setting the levels of the frame column.

library(MovingBubbles)
dat <- data.frame(alphabets = rep(letters[1:6],5),
                  time = rep(paste0(1:5, "pm"), each = 6),
                  size = round(runif(30)*100))
dat$time <- factor(dat$time, levels = rep(paste0(1:5, "pm")))
MovingBubbles(dat, key = "alphabets", frame = "time", value = "size")

demo

Installation

devtools::install_github("chengvt/MovingBubbles", dependencies = TRUE)

About

Animated d3 bubble chart

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages