Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Quantile-quantile plot

Be the first to rate this file! 1 Download (last 30 days) File Size: 5.07 KB File ID: #46779 Version: 1.1.1
image thumbnail

Quantile-quantile plot



28 May 2014 (Updated )

Quantile-quantile plot with patch option

| Watch this File

File Information

qq_plot(y) displays a quantile-quantile plot of the sample quantiles of y versus theoretical quantiles from a normal distribution. If the distribution of y is normal, the plot will be close to linear.
qq_plot(x,y) displays a quantile-quantile plot of two samples. If the samples come from the same distribution,the plot will be linear.
The inputs x and y should be numeric and have an equal number of elements; every element is treated as a member of the sample.

The plot displays the sample data with the plot symbol 'x'. Superimposed on the plot is a dashed straight line connecting the first and third quartiles.

qq_plot(...,mode) allows the appearance of the plot to be configured. With mode='line' (default), the plot appears as described above. With mode='patch', the data are plotted as a patch object, with the area bound by the x-distribution and the linear fit shaded grey. With mode='both' the two appearances are combined.

qq_plot(...,mode,method) and qq_plot(...,[],method) allows the method for calculating the quartiles, used for the fit line, to be specified. The default is 'R-8'. Type 'help quantile2' for more information. The latter form of the function call uses the default mode.

h = qq_plot(...) returns a two- or three-element vector of handles to the plotted object. The nature of the handles depends upon the mode. In all cases, the first handle is to the sample data, the second handle is to the fit line. With mode='patch' or mode='both', there is third handle to the patch object.


% Display Q-Q plots for the rand and randn functions
h = qq_plot(randn(20),'patch');
set(h(3),'FaceColor','r') % change fill colour

Note: requires quantile2.m from No other toolboxes required.

MATLAB release MATLAB 8.0 (R2012b)
MATLAB Search Path
Other requirements quantile2.m from
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
29 May 2014 1.1

Added 'method' input for consistency with other functions.

20 May 2015 1.1.1

Fixed error caused by new Matlab graphics objects.

Contact us