How to customize qqplot()?

The advantage of using `qqplot()` over `qqPlot()` is that we have more control over how to customize our plot. We can use any argument that works with `par()` or `plot()`, such as changing colors (`col`), symbols (`pch`), sizes (`cex`), labels (`xlab`, `ylab`, etc.), limits (`xlim`, ylim`) and so on. For example:

R




x <- rnorm(100)
z <- qnorm(ppoints(x))
 
# customize plot
qqplot(z,x,
col = "blue",
pch = 16,
cex = 1.5,
xlab = "Normal Quantiles",
ylab = "Sample Quantiles",
main = "QQ Plot",
xlim = c(-3.5, 3.5),
ylim = c(-3.5, 3.5))
abline(0,1,
col = "red",
lwd = 2,
lty = 2)


Output:

qqplot with plot customization in R

We can see that we have changed several aspects of our plot according to our preferences.

How to use qqplot() instead of qqPlot() in car package?

In this article, we will explain how to use the base R function ‘qqplot()’ instead of the ‘qqPlot()’ function from the `car` package to check the normality of a variable or a set of residuals. I will also show how to customize the plot and add confidence envelopes.

Similar Reads

What is a QQ plot?

A QQ plot (quantile-quantile plot) is a graphical tool that compares the empirical quantiles of a variable (or residuals) with the theoretical quantiles of a reference distribution (usually normal). The QQ plot can help us assess if the variable (or residuals) follows a certain distribution, by checking if the points fall approximately on a straight line. If there are deviations from linearity, such as curvature or outliers, it indicates that the variable (or residuals) does not follow that distribution....

How to use qqplot()?

The base R function ‘qqplot(x, y)’ takes two vectors of numeric values as arguments and plots their sorted values against each other. This allows us to visually compare if ‘x’ and ‘y’ come from similar distributions. For example, we can compare two random samples from different distributions:...

How to customize qqplot()?

...

How to add confidence envelopes?

...