Visualization of a Correlation Matrix

Provides a visual exploratory tool on correlation matrix that supports automatic variable reordering to help detect hidden patterns among variables.

The R package corrplot is for visualizing correlation matrices and confidence intervals. It also contains some algorithms to do matrix reordering. For examples, see its vignette.

This package is licensed under GPL, and available on CRAN:

M <- cor(mtcars)
corrplot(M, order = "hclust", addrect = 2)

To download the development version of the package, type the following at the R command line:

devtools::install_github("taiyun/corrplot", build_vignettes = TRUE)

To download the release version of the package on CRAN, type the following at the R command line:

  • Fork, clone, edit, commit, push, create pull request
  • Use RStudio
  • Unit-testing: press CTRL+SHIFT+T in RStudio
    • we know that is hard to write tests especially for a visual package like this

If you encounter a clear bug, please file a minimal reproducible example on github.

We use lintr which also performs the analysis on Travis-CI. Configuration for lintr is in .lintr file. Lints are treated as warnings, but we strive to be lint-free.

In RStudio, you can run lintr from the console as follows: r

This package is free and open source software, licensed under GPL.

  • Corrplot listed at OpenHub:
  • CRAN:


	CHANGES IN corrplot VERSION 0.81


  • Fixed #79: added parameter win.asp to control aspect ratio

  • Fixed #18: parameter outline combined with method="pie" controls the color of the otline circle of each pie.

  • updated vignette

    CHANGES IN corrplot VERSION 0.80


  • Fixed #70: Enable to plot a matrix with NA when 'is.corr = F'

    CHANGES IN corrplot VERSION 0.77


  • Fixed #58: make sure the margin is correct in corrplot.mixed().

  • Revised document.

    CHANGES IN corrplot VERSION 0.76


  • In corrplot(), added parameters na.label and na.label.col that define how NA values inside a matrix should be rendered.

  • In corrplot(), na.label can now use one or two characters, default is "?" (issue #55)

  • Fixed #17: restore par() settings on exit (thanks, #yihui)

  • Fixed #16: checks for [-1, 1] interval are too strict.

  • Fixed #15: error with correlation plot using insig argument when all values are significant.

  • Fixed #9: added ward.D and ward.D2 hclust methods (thanks, #jeffzemla)

    CHANGES IN corrplot VERSION 0.70


  • In corrplot(), parameter insig add a option "p-value", now p-values can be conveniently added on the glyph.

  • Return value changes, corrplot() now returns a reordered correlation matrix.

    CHANGES IN corrplot VERSION 0.66


  • Add html vignette, which was generated from markdown file by knitr.

  • In corrplot(), remove parameter "zoom", add "is.corr"; now it is more convenient to visualize non-correlation matrix. Parameter "addtextlabel" was renamed as "tl.pos", and "addcolorlabel" was renamed as "cl.pos".

    CHANGES IN corrplot VERSION 0.60


  • Now corrplot() can deal with the matrix not in [-1,1] by parameter "zoom" now. Warning: please make sure the visualization you take after data zoom is meaningful!


  • Function corr.rect() was renamed as corrRect().

  • Revise document. (THANKS, Tao Gao)

  • In function corrplot(), "order"'s choice "PCA" was precisely renamed as "AOE". and "FPC" was added for the first principal component order.

  • Add function corrMatOrder(), and corrplot.mixed().

  • Remove seldom used functions:, corrplot.ellipse(), corrplot.square(), corrplot.shade(), corrplot.color(), corrplot.number().

  • In corrplot(), remove parameter "assign.col" and "cl.range", add "zoom", "cl.lim" and "addCoefasPercent".

    CHANGES IN corrplot VERSION 0.54


  • Parameter "tl.cex" in function corrplot() is more sensitive.


  • The issue that too much space adding to the margins (especially using a longer text label or a larger font size) has been fixed.
  • Specifying wrong color to the glyphs has been fixed.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.92 by Taiyun Wei, 12 days ago

Report a bug at

Browse source code at

Authors: Taiyun Wei [cre, aut] , Viliam Simko [aut] , Michael Levy [ctb] , Yihui Xie [ctb] , Yan Jin [ctb] , Jeff Zemla [ctb] , Moritz Freidank [ctb] , Jun Cai [ctb] , Tomas Protivinsky [ctb]

Documentation:   PDF Manual  

MIT + file LICENSE license

Suggests seriation, knitr, RColorBrewer, rmarkdown, magrittr, prettydoc, testthat

Imported by BNSP, BasketballAnalyzeR, CINNA, COINr, EcotoneFinder, ExPanDaR, GmAMisc, GoodmanKruskal, LDLcalc, ModelMap, MultivariateAnalysis, NetworkToolbox, PLNmodels, RclusTool, SLEMI, Statsomat, TestDimorph, aslib, bayesGAM, bigtime, bioOED, dynRB, echarts4r, fabMix, factorstochvol, fdcov, frechet, grapesAgri1, jSDM, ldsep, mastif, miceRanger, mixKernel, polyPK, rstatix, scRNAtools, shinyr, uHMM, veccompare.

Depended on by abcdeFBA, twl.

Suggested by ClustImpute, HTLR, Hmsc, analysisPipelines, boral, candisc, colourvision, dendextend, eechidna, geodiv, gllvm, kergp, knitrBootstrap, mashr, missSBM, rattle, spectralGraphTopology, textreg.

See at CRAN