A Q-Q plot (or Quantile-Quantile plot) is used to compare quantile distribution of a sample to a theoretical quantile distribution. Often, this is used to visually estimate whether a sample distribution is (close to) normal, in which case the quantiles are nicely aligned in the plot. Note that this type of visual estimation does not replace a proper statistical test for normality.

We will see how to use `ggplot()`

to code for a Q-Q plot representing a sample which is normally distributed. Here is the dataframe:

```
# dataframe
df <- data.frame(ID, values)
```

In ggplot2, Q-Q plots are drawn by the functions `stat_qq()`

and `geom_qq()`

. Here we use `stat_qq()`

:

```
ggplot(df, aes(sample=values)) +
stat_qq()
```

It is of course possible to tune the look of the plot with, for example, `size=`

and `color=`

:

```
ggplot(df, aes(sample=values)) +
stat_qq(size = 2, color = "blue")
```

To better verify the alignment of the dots, one can add a *quantile-quantile line* by the mean of `stat_qq_line()`

. This line can also be tuned with similar arguments:

```
ggplot(df, aes(sample=values)) +
stat_qq(size = 2, color = "blue") +
stat_qq_line(size=1.25, color="red")
```

In this section, you will learn how to set/modify all the necessary elements that make a plot complete and comprehensible. Such elements are:

- plot title,
- axis title,
- axis scale,
- axis ticks,
- category labels,
- legend,
- secondary Y-axis,
- colors,
- etc.