Skip to content
Related Articles

Related Articles

Draw a Quantile-Quantile Plot in R Programming – qqline() Function

View Discussion
Improve Article
Save Article
  • Last Updated : 16 Dec, 2021

The Quantile-Quantile Plot in Programming Language, or (Q-Q Plot) is defined as a value of two variables that are plotted corresponding to each other and check whether the distributions of two variables are similar or not with respect to the locations. qqline() function in R Language is used to draw a Q-Q Line Plot.

R – Quantile-Quantile Plot

Syntax: qqline(x, y, col)


  • x, y: X and Y coordinates of plot
  • col: It defines color

Returns: A QQ Line plot of the coordinates provided 

Quantile-Quantile Plot in R Example

Example 1: Implementation of Basic QQplot Interpretation using qqline() Function in R


# Set seed for reproducibility
# Create random normally distributed values
x <- rnorm(1200)
# QQplot of normally distributed values
# Add qqline to plot
qqline(x, col = "darkgreen")


Above is a representation of QQplot of Normally Distributed Random Numbers.

Example 2: Implementation of QQplot of Logistically Distributed Values  


# Set seed for reproducibility
# Random values according to logistic distribution
# QQplot of logistic distribution
y <- rlogis(800)
# QQplot of normally distributed values
# Add qqline to plot
qqline(y, col = "darkgreen")


Above is the Q-Q Plot of theoretical quantiles. 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!