Interactive Web-Based Data Visualization with R, plotly, and shiny  book cover
1st Edition

Interactive Web-Based Data Visualization with R, plotly, and shiny

ISBN 9781138331457
Published January 21, 2020 by Chapman and Hall/CRC
470 Pages

FREE Standard Shipping
SAVE $15.99
was $79.95
USD $63.96

Prices & shipping based on shipping country


Book Description

The richly illustrated Interactive Web-Based Data Visualization with R, plotly, and shiny focuses on the process of programming interactive web graphics for multidimensional data analysis. It is written for the data analyst who wants to leverage the capabilities of interactive web graphics without having to learn web programming. Through many R code examples, you will learn how to tap the extensive functionality of these tools to enhance the presentation and exploration of data. By mastering these concepts and tools, you will impress your colleagues with your ability to quickly generate more informative, engaging, and reproducible interactive graphics using free and open source software that you can share over email, export to pdf, and more.

Key Features:

  • Convert static ggplot2 graphics to an interactive web-based form
  • Link, animate, and arrange multiple plots in standalone HTML from R
  • Embed, modify, and respond to plotly graphics in a shiny app
  • Learn best practices for visualizing continuous, discrete, and multivariate data
  • Learn numerous ways to visualize geo-spatial data

This book makes heavy use of plotly for graphical rendering, but you will also learn about other R packages that support different phases of a data science workflow, such as tidyr, dplyr, and tidyverse. Along the way, you will gain insight into best practices for visualization of high-dimensional data, statistical graphics, and graphical perception. The printed book is complemented by an interactive website where readers can view movies demonstrating the examples and interact with graphics.

Table of Contents


Why interactive web graphics from R?

What you will learn

What you won’t learn (much of)

Web technologies



Graphical data analysis

Data visualization best practices


Run code examples

Getting help and learning more



I Creating views


Intro to plot_ly()

Intro to plotlyjs

Intro to ggplotly()

Scattered foundations


Alpha blending



Stroke and span


Dotplots & error bars




Density plots

Parallel Coordinates




Integrated maps



Custom maps

Simple features (sf)


Bars & histograms

Multiple numeric distributions

Multiple discrete distributions


D frequencies

Rectangular binning in plotlyjs

Rectangular binning in R

Categorical axes

D charts






II Publishing views


Saving and embedding HTML

Exporting static images

With code

From a browser

Sizing exports

Editing views for publishing

III Combining multiple views

Arranging views

Arranging plotly objects

Recursive subplots

Other approaches & applications

Arranging htmlwidgets


Bootstrap grid layout

CSS flexbox

Arranging many views

Animating views

Animation API

Animation support

IV Linking multiple views


Client-side linking

Graphical queries

Highlight versus filter events

Linking animated views


Querying facetted charts

Statistical queries

Statistical queries with ggplotly()

Geo-spatial queries

Linking with other htmlwidgets

Generalized pairs plots

vi Contents

Querying diagnostic plots


Server-side linking with shiny

Embedding plotly in shiny

Your first shiny app

Hiding and redrawing on resize

Leveraging plotly input events

Dragging events

D events

Edit events

Relayout vs restyle events

Scoping events

Event priority

Handling discrete axes

Accumulating and managing event data

Improving performance

Partial plotly updates

Partial update examples

Advanced applications



A draggable brush


V Event handling in JavaScript


Working with JSON

Assignment, subsetting, and iteration

Mapping R to JSON

Adding custom event handlers

Supplying custom data

Leveraging web technologies from R

Web infrastructure

Modern JS & React

VI Various special topics

Is plotly free & secure?

Improving performance

Controlling tooltips

plot_ly() tooltips

ggplotly() tooltips


Control the modebar

Remove the entire modebar

Remove the plotly logo

Remove modebar buttons by name

Add custom modebar buttons

Control image downloads

Working with colors

Working with symbols and glyphs

Embedding images

Language support

LaTeX rendering

MathJax caveats

The data-plot-pipeline

Improving ggplotly()

Modifying layout

Modifying data

Leveraging statistical output

Translating custom ggplot geoms

View More



Carson Sievert is the author and maintainer of the plotly R package, a recipient of the American Statistical Association’s 2017 John Chambers award, and Program Chair of the Section on Statistical Graphics. After receiving a PhD in statistics from Iowa State, Carson joined RStudio as a software engineer to work on software that bridges R and web technologies such as shiny, plotly, and rmarkdown.


"Plotly is the most-downloaded interactive graphics system for R, and this book should help all plotly users—both new and experienced—understand more about plotly graphics. With this in mind, I feel that this book (once it makes its way to a final form) will have a wide appeal for a large swath of R users. This audience will include both statisticians and data scientists, and a wide range of education and experience levels, ranging from the novice student to the seasoned data scientist to the statistics faculty member…I suspect a book on plotly will be wildly successful."
~Adam Loy, Carleton College

"This book is well-written and well-structured. The potential readership of this book is those who would like to learn or master interactive data visualization with R, and I’m not aware of any competing books in this regard. Both novice R users and experts could find this book useful and learn about plotly more systematically. Data practitioners could obtain lots of practical advice on how to make their plotly applications more responsive and more aesthetically appealing. I would also recommend this book as the textbook for courses that focus on data visualisation using web technology."
~Earo Wang, Monash University

"This book fills a gap in the currently-available texts, providing information on making interactive graphics in R. I recently taught a course entitled ‘Advanced Statistical Software,’ and found it difficult to locate resources on and shiny. As far as I know, this is the first book to really cover these topics. As with many other books published by Chapman and Hall, the availability of the website version of the book is extremely useful for the R community. I have already used materials from the web version, but if I were to teach this course again I would consider making the paper book a required text…Because Dr. Sievert wrote the plotly R package, he is clearly the world expert in the material. He also brings a wealth of general visualization knowledge to the book, which is full of rich references to other materials."
~Amelia McNamara, University of St. Thomas

"This text would be an excellent resource for an advanced (graduate level) data visualization course. I think it could also be very valuable in data journalism coursework, where interactivity is a powerful communication tool. The book is very clearly written, and there are plenty of examples to demonstrate the tools to the reader…I especially enjoyed that the author provides the reader with a link to an RStudio cloud environment with which to run all of the examples in the book on their own. I believe this is an essential piece to this and any other modern computing text."
~Sam Tyner

"Some sections of this book will be very useful for two classes I teach. One is introduction to data science where I teach about JSON and HTML data and how to display them. The second course is a data visualization course where I teach interactive visualization…Currently, I am recommending several books. This book will certainly be an addition, in the sense that it provides detailed materials on interactive visualization."
~Mahbubul Majumder, University of Nebraska