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:

Following successful installation, it is important to include the library in the R workspace, as follows:

The following output message is generated:

Now, let's look at scatter plots in the following section.