# Normal Probability Plot in R

Sheeraz Gul May 24, 2022

The normal probability plot is the graphical representation of data. This tutorial demonstrates how to plot the normal probability in R.

## Normal Probability Plot in R

The normal probability plot shows the normal distribution of the given data set. It compares the dataset with the normal distribution.

It should show a straight line if the data is normally distributed. We can use the `ggplot2` with the `ggplotr` package to plot the normal probability graph.

First of all, install these packages:

``````install.packages("ggplot2")

install.packages("qqplotr")
``````

Once the packages are successfully installed, we create a data set for normal distribution, for which we will plot the normal probability graph. We will use the functions `stat_qq_point()` and `stat_qq_line()` to plot the normal probability.

See example:

``````install.packages("ggplot2")
install.packages("qqplotr")

library(ggplot2)
library(qqplotr)

# random data for normal distribution
normal_distribution = rnorm(1000, mean = 110, sd = 60)

# plot the data without line and labels
ggplot(mapping = aes(sample = normal_distribution)) + stat_qq_point(size = 3)+ stat_qq_line(color="green")
``````

The code above will plot the graph for the normal probability of given data with a green straight line. See output:

Author: Sheeraz Gul

Sheeraz is a Doctorate fellow in Computer Science at Northwestern Polytechnical University, Xian, China. He has 7 years of Software Development experience in AI, Web, Database, and Desktop technologies. He writes tutorials in Java, PHP, Python, GoLang, R, etc., to help beginners learn the field of Computer Science.