O'Reilly logo

R Data Visualization Cookbook by Atmajitsinh Gohil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A simple line plot

Line plots are simply lines connecting all the x and y dots. They are very easy to interpret and are widely used to display an upward or downward trend in data. In this recipe, we will use the googleVis package and create an interactive R line plot. We will learn how we can emphasize on certain variables in our data. The following line plot shows fertility rate:

A simple line plot

Getting ready

We will use the googleVis package to generate a line plot.

How to do it…

In order to construct a line chart, we will install and load the googleVis package in R. We would also import the fertility data using the read.csv() function:

install.packages("googleVis") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required