Before installing ggplot2, make sure that you have a recent version of R from the official website: http://r-project.org.
Run the following code to install ggplot2:
install.packages("ggplot2")
From this, we will get the following output:
![](https://static.packt-cdn.com/products/9781789804379/graphics/assets/376c640d-64db-42fd-82d6-c9871a72688a.png)
Following successful installation, it is important to include the library in the R workspace, as follows:
![](https://static.packt-cdn.com/products/9781789804379/graphics/assets/015ff44c-f8f5-46c0-b2e2-21facf42686b.png)
The following output message is generated:
![](https://static.packt-cdn.com/products/9781789804379/graphics/assets/ab2ca40c-22bc-4712-a8c5-7dd31e466df4.png)
Now, let's look at scatter plots in the following section.