Using plotly

So far, we have looked at various scenarios of creating plots using the ggplot2 library. In order to take the plotting to a new level, there are many libraries which can be referred to. Out of them, one library is plotly, which is designed as an interactive browser-based charting library built on the JavaScript library. Let's look at a few examples on how it works.

Bubble plot

Bubble plot is a nice visualization in which the size of the bubble indicates the weight of each variable as it is present in the dataset. Let's look at the following plot:

> #Bubble plot using plotly

> plot_ly(Cars93, x = Length, y = Width, text = paste("Type: ", Type),


+ mode = "markers", color = Length, size = Length)

The combination of ggplot2 with the ...

Get R: Mining Spatial, Text, Web, and Social Media Data now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.