Skip to content

DhandabaniRaja/scatterD3

 
 

Repository files navigation

scatterD3 is an HTML R widget for interactive scatter plots visualization. It is based on the htmlwidgets R package and on the d3.js javascript library.

CRAN Downloads Travis-CI Build Status CRAN_Status_Badge

Features

scatterD3 currently provides the following features :

  • Display points and text labels
  • Possibility to map color, symbol and size with other variables (automatic legend)
  • Zoom with mouse wheel, pan with mouse while zoomed in
  • Ability to drag and move text labels
  • Customizable tooltips when hovering points
  • Points highlighting when hovering legend items
  • Option to draw confidence ellipses around group of points
  • Charts integrated inside a Shiny app are fully updatable with smooth transitions when settings or data change
  • Lasso selection tool integration via d3-lasso-plugin for points highlighting

Here is a small preview of what you will get :

example

You can also test it live with the sample shiny app.

Installation

Install latest stable release from CRAN :

install.packages("scatterD3")

Or from Github for the latest, bleeding edge, full of bugs version :

devtools::install_github("juba/scatterD3")

Usage

Quick example of the scatterD3 function based on the mtcars dataset :

mtcars$names <- rownames(mtcars)
scatterD3(data = mtcars, x = wt, y = mpg, lab = names,
          col_var = cyl, symbol_var = am,
          xlab = "Weight", ylab = "Mpg", col_lab = "Cylinders",
          symbol_lab = "Manual transmission")

See the introduction vignette for a step-by-step guide and details about the different function arguments.

Shiny integration

Like every R HTML widget, shiny integration is straightforward. But as a D3 widget, scatterD3 is updatable : changes in settings or data can be displayed via smooth transitions instead of a complete chart redraw, which can provide interesting visual clues.

Furthermore, scatterD3 provides some additional handlers to two interactive features : SVG export and zoom resetting.

The sample scatterD3 shiny app allows you to see the different features described here. You can check its source code on GitHub and the introduction vignette for a better understanding of the different arguments.

Credits

This package has been made possible by :

About

R scatter plot htmlwidget based on D3.js

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 77.7%
  • R 20.5%
  • CSS 1.8%