
Introduction
The main motivation behind this chapter is to introduce the basics of plotting in R and an element of interactivity via the googleVis
package. The basic plots are important as many packages developed in R use basic plot arguments and hence understanding them creates a good foundation for new R users. We will start by exploring the scatter plots in R, which are the most basic plots for exploratory data analysis, and then delve into interactive plots. Every section will start with an introduction to basic R plots and we will build interactive plots thereafter. We will utilize the power of R analytics and implement them using the googleVis
package to introduce the element of interactivity.
The googleVis
package is developed by Google and it uses the Google Chart API to create interactive plots. There are a range of plots available with the googleVis
package and this provides us with an advantage to plot the same data on various plots and select the one that delivers an effective message. The package undergoes regular updates and releases, and new charts are implemented with every release.
The readers should note that there are other alternatives available to create interactive plots in R, but it is not possible to explore all of them and hence I have selected googleVis
to display interactive elements in a chart. I have selected these purely based on my experience with interactivity in plots. The other good interactive package is offered by GGobi.
This chapter is broken down into six major parts. The first part introduces the basics of plotting in R using scatter plots as an example and also introduces the users to interactivity using the iPlots
package. The second part introduces bar plot functionality in R and further introduces the googleVis
package to create an interactive bar plot. The third part delves into line plots and how we can make them more meaningful by simply making use of the options available in the line plot functionality in the googleVis
package. The fourth section of the book discusses interactive histograms. We conclude the chapter by introducing interactive bubble plots and waterfall plots in parts five and six, respectively.