Normal Probability Plot in R using ggplot2 Last Updated : 06 Aug, 2025 Comments Improve Suggest changes Like Article Like Report A normal probability plot is a graphical representation of the data. A normal probability plot is used to check if the given data set is normally distributed or not. It is used to compare a data set with the normal distribution. If a given data set is normally distributed then it will reside in a shape like a straight line.Example 1: We are plotting a Q-Q plot using only ggplot2 to visualize how sample data compares to a normal distribution using quantile points and a reference line.library: Loads the ggplot2 package into the session.set.seed: Ensures the same random values are generated every time.random_values: A numeric vector of 500 normally distributed values.rnorm: Generates random numbers from a normal distribution.data.frame: Creates a data frame to hold the random sample.ggplot: Initializes the plot with the given data and aesthetics.aes: Maps the sample values for Q-Q plotting.stat_qq: Plots sample quantiles against theoretical normal quantiles.stat_qq_line: Adds a straight reference line to the Q-Q plot. R install.packages("ggplot2") library(ggplot2) set.seed(1) random_values <- rnorm(500, mean = 90, sd = 50) ggplot(data = data.frame(sample = random_values), aes(sample = sample)) + stat_qq() + stat_qq_line(col = "blue") Output:OutputExample 2: Plotting data points with line using stat_qq_line() function.aes(): Defines the aesthetic mappings like which variable to plot.stat_qq(): Plots the quantile-quantile points on the graph.stat_qq_line(): Adds a reference line to indicate the theoretical quantile distribution.xlab(): Sets the label for the x-axis.ylab(): Sets the label for the y-axis.random_values: The dataset created using rnorm() containing normally distributed random values. R library(ggplot2) random_values = rnorm(500, mean = 90, sd = 50) ggplot(mapping = aes(sample = random_values)) + stat_qq(size = 2, color = "red") + stat_qq_line(color = "green") + xlab("x-axis") + ylab("y-axis") Output:OutputThe output will display a Q-Q plot that compares the sample data to a theoretical normal distribution. If the data is normally distributed, the points will closely follow the green reference line. Deviations from this line suggest departures from normality. The red dots represent the actual quantile values of the sample. Comment More info A amnindersingh1414 Follow Improve Article Tags : R Language R-plots R-Charts R-Graphs Explore R Tutorial | Learn R Programming Language 4 min read IntroductionR Programming Language - Introduction 4 min read Interesting Facts about R Programming Language 4 min read R vs Python 5 min read Environments in R Programming 3 min read Introduction to R Studio 4 min read How to Install R and R Studio? 4 min read Creation and Execution of R File in R Studio 5 min read Clear the Console and the Environment in R Studio 2 min read Hello World in R Programming 2 min read Fundamentals of RBasic Syntax in R Programming 3 min read Comments in R 3 min read R-Operators 5 min read R-Keywords 2 min read R-Data Types 5 min read VariablesR Variables - Creating, Naming and Using Variables in R 5 min read Scope of Variable in R 5 min read Dynamic Scoping in R Programming 5 min read Lexical Scoping in R Programming 4 min read Input/OutputTaking Input from User in R Programming 7 min read Printing Output of an R Program 4 min read Print the Argument to the Screen in R Programming - print() Function 2 min read Control FlowControl Statements in R Programming 4 min read Decision Making in R Programming - if, if-else, if-else-if ladder, nested if-else, and switch 3 min read Switch case in R 2 min read For loop in R 5 min read R - while loop 5 min read R - Repeat loop 2 min read goto statement in R Programming 2 min read Break and Next statements in R 3 min read FunctionsFunctions in R Programming 5 min read Function Arguments in R Programming 4 min read Types of Functions in R Programming 6 min read Recursive Functions in R Programming 4 min read Conversion Functions in R Programming 4 min read Data StructuresData Structures in R Programming 4 min read R Strings 6 min read R-Vectors 4 min read R-Lists 6 min read R - Array 7 min read R-Matrices 10 min read R-Factors 4 min read R-Data Frames 6 min read Object Oriented ProgrammingR-Object Oriented Programming 7 min read Classes in R Programming 3 min read R-Objects 3 min read Encapsulation in R Programming 3 min read Polymorphism in R Programming 6 min read R - Inheritance 7 min read Abstraction in R Programming 3 min read Looping over Objects in R Programming 5 min read S3 class in R Programming 8 min read Explicit Coercion in R Programming 3 min read Error HandlingHandling Errors in R Programming 3 min read Condition Handling in R Programming 5 min read Debugging in R Programming 3 min read Like