-
New argument
cell.gridto draw a light rectangle around every cell (behind the glyphs) and drop the through-center gridlines, so the sized glyphs (method = "circle"orscale.square = TRUE) sit inside boxed cells -- the corrplot boxed-cell look:ggcorrplot(corr, method = "circle", cell.grid = TRUE). The cell border color is set with the companion argumentcell.grid.col(default"grey90"). Defaults toFALSE; has no effect on a full-tile square heatmap, whose tiles already carry anoutline.colorborder. -
New argument
scale.squareto size the squares by the absolute correlation whenmethod = "square":ggcorrplot(corr, scale.square = TRUE)scales each square (larger = stronger correlation) on top of the fill color, the classic corrplot size-scaled square look. Defaults toFALSE(constant full-cell squares, unchanged); has no effect formethod = "circle"(circles are always sized). -
New argument
presetfor publication-grade output in one token:ggcorrplot(corr, preset = "publication")sets white cell outlines and the colorblind-safe"RdBu"palette. It only fills arguments you did not supply, so anything you pass explicitly (e.g.outline.color,colors,palette) overrides the preset. Defaults toNULL(no preset), leaving existing calls unchanged. -
New argument
paletteto pick a built-in colorblind-safe diverging palette for the fill gradient:ggcorrplot(corr, palette = "RdBu")(or"PuOr"). Each is an 11-stop ramp with white at zero and the usual cool = negative / warm = positive polarity, so it is a one-word alternative to spelling outcolors. Defaults toNULL(usecolors), leaving existing calls unchanged. -
New value
insig = "stars"to mark the significant cells with significance stars (***/**/*for p <= 0.001/0.01/0.05 -- fixed thresholds, notsig.level) instead of crossing out the insignificant ones. Works withoutlab, soggcorrplot(corr, p.mat = p.mat, insig = "stars")is a standalone significance map. The defaultinsig = "pch"is unchanged. -
New arguments
lower.methodandupper.methodfor a mixed layout: a different glyph per triangle, e.g. the coefficients as numbers in the lower triangle, circles in the upper, and the variable names on the diagonal (ggcorrplot(corr, lower.method = "number", upper.method = "circle")). Each accepts "square", "circle" or "number"; both default toNULL, leaving the single-method output unchanged (#85). Requested by @Breeze-Hu. -
New argument
hc.rectto draw rectangles around the clusters of a hierarchically-ordered correlogram:ggcorrplot(corr, hc.order = TRUE, hc.rect = 3)frames the 3 clusters obtained by cutting the tree. Defaults toNULL(no rectangles). The rectangle outline color is set with the companion argumenthc.rect.col(default"gray30", e.g.hc.rect.col = "white").
-
The plot axis is now always drawn in the matrix (row/column) order. This fixes a bug where
hc.order = TRUEwas silently ignored for correlation matrices with numeric-looking variable names (e.g."1","2", ...):reshape2::melttype-converted such names to a continuous axis sorted by value, discarding the clustering order (#37). As a consequence, theas.isargument no longer affects the plot (it is kept only for backward compatibility) -- a call usingas.is = TRUE, which previously produced an alphabetically-ordered axis, now follows the matrix order like every other call. Reported by @cabaez (#37). -
show.diag = FALSEon a non-square matrix no longer blanks the wrong cells. The diagonal has no positional meaning for an m x n matrix, yet the removal wipedmin(m, n)cells along the leading diagonal; it now removes only the genuine self-pairs (a row and column naming the same variable), leaving a matrix with disjoint row and column variables untouched. Square matrices, and non-square matrices without dimnames, are unaffected. Follows up the non-square support requested by @mt1022 (#5) and @qalid7 (#10).
-
Added an introductory vignette,
vignette("ggcorrplot"), walking through the package end to end: the inputs, glyphs and layouts, clustering, coefficient labels, significance styles, and theming. -
Added a second vignette,
vignette("publication-ready-correlation-plots"), a gallery of finished publication-ready correlogram recipes (clustered, triangle, significance, circle, colorblind palette, edgeless heatmap, rectangular predictor-by-outcome matrix, and full ggplot2 polish). -
Internal refactor: the data-preparation pipeline and the glyph-layer construction are now factored into internal helpers, with no change to the output of any existing call. This is groundwork for forthcoming per-triangle layout options.
-
The help page and the README now link to the Datanovia correlation tutorials for worked examples of the plot and of the p-value matrix.
-
New argument
sig.starsto append significance stars (***,**,*) to the coefficient labels whenlab = TRUEand ap.matis supplied, e.g."-0.85**". Defaults toFALSE(#26, #41, #50; inspired by the ggcorrplot2 package by @caijun). -
New argument
circle.scaleto scale the circle sizes whenmethod = "circle", useful when the output device size makes the default circles too small or too large. Defaults to1(contributed by @jdeut, #8). -
New argument
nsmallto set a minimum number of decimals in the coefficient labels (e.g.nsmall = 2keeps trailing zeros such as 0.70). Defaults to0, the current behavior (#43; label-formatting idiom suggested by @PawelKulawiak in #15). -
New argument
legend.limitto control the limits of the fill color scale. Defaults toc(-1, 1); setlegend.limit = NULLto use the data range, e.g. to display a covariance matrix (#54). -
The
colorsargument now accepts a vector of any length>= 2, not only 3. A length-3 vector still maps to low/mid/high viascale_fill_gradient2(default output unchanged); any other length is spread across the scale withscale_fill_gradientn, so an n-color palette such asRColorBrewer::brewer.pal(11, "RdBu")can be passed straight tocolors =without adding a second fill scale (and without the "Scale for fill is already present" message) (#52). Requested by @glocke-senda. -
New argument
coord.fixed(defaultTRUE) to optionally drop the fixed 1:1 aspect ratio. Setcoord.fixed = FALSEto let the cells fill the plotting area, which can look better with many long variable names (#40). -
New argument
lab_fontfaceto set the font face ("plain","bold","italic","bold.italic") of the correlation coefficient labels. Defaults to"plain", the current behavior (#15). -
New argument
leading.zeroto drop the leading zero of the coefficient labels (e.g..23,-.67instead of0.23,-0.67), common in correlation tables. Defaults toTRUE(leading zero kept, current behavior); setleading.zero = FALSEto remove it (#15; idiom from @PawelKulawiak's comment). -
New arguments
tl.vjustandtl.hjustto control the vertical and horizontal justification of the x-axis text labels. Both default to1, the current behavior (#56). -
New argument
useincor_pmat()to align the p-value matrix'sNApattern with a correlation matrix. The default"pairwise.complete.obs"keeps the current behavior;use = "everything"sets a pair toNAas soon as either variable has a missing value, matchingcor()'s default so the two matrices line up (@elizabethwe, #51).
-
Replaced the deprecated
ggplot2::aes_string()with tidy-evaluationaes()internally, silencing the ggplot2 deprecation warnings on recentggplot2versions. Default output is unchanged (#57, #58, #59, #60, #61). Based on the contribution by @jeherschberger (#62). -
Added a
CITATIONfile socitation("ggcorrplot")returns a proper reference (#42, #47). -
Added an internal structural regression test suite that asserts on the built plot (layer composition, built data, fill-scale semantics, coordinate system, ordering and significance handling), so the plot's structure is checked on CI and CRAN and not only by the local visual snapshots (#81).
-
cor_pmat()no longer aborts when a pair of variables has fewer than three overlapping non-missing observations to correlate (e.g. two variables that never co-occur). Such a pair now returnsNAfor that cell instead of erroring out for the whole matrix; pairs that can be tested are computed as before (@elizabethwe, #51). -
A non-square (m x n) correlation matrix now gives a clear error when combined with
hc.order = TRUEortype = "lower"/"upper"(which require a square matrix), instead of silently producing an incorrect plot.type = "full"still works for non-square matrices (#5, #10). -
The significance markers no longer error or misalign when the correlation matrix and the p-value matrix have different missing-value patterns. P-values are now matched to each cell by name instead of by row position.
-
When
hc.order = TRUE, the hierarchical clustering is now computed on the unrounded correlation matrix. Previously the matrix was rounded todigitsbefore clustering, so the internal rounding could introduce ties that changed the ordering (@buddha2490, #14). -
The
tl.colargument (color of the axis text labels) is now applied; it was previously ignored. It defaults toNULL, inheriting the color from the theme, so the default appearance is unchanged (@LafontRapnouilTristan, #44, #45). -
The significance test is no longer affected by
hc.order. Previously, whenhc.order = TRUE, the p-value matrix was rounded todigitsbefore being compared withsig.level, so a p-value just above the threshold (e.g. 0.054) could be shown as significant while the same data withhc.order = FALSEshowed it as non-significant (@worden-lee, #25). -
The significance markers now stay aligned with the tiles when the matrix has numeric-looking names. The p-value matrix is now reshaped with the same
as.issetting as the correlation matrix, soas.is = TRUEno longer places the markers off-plot (@cabaez, #37).
-
New argument
as.isadded. A logical passed to melt.array. If TRUE, dimnames will be left as strings instead of being converted using type.convert (@fdetsch, #24). -
Gets rid of
NOTEin CRAN daily checks about lazy data. -
Adds visual regression testing infrastructure using
vdiffr. -
Removes warnings stemming from the latest version of
ggplot2.
-
The option
hc.methodis now taken into account (#mitchelfruin, #29) -
The option
show.diagnow works for full matrix (@arbet003 , #31)
- Support an object of class
cor_matas returned by the functioncor_mat()[rstatix package]
Merging with pull request 16 (@IndrajeetPatil, #16), which addresses the following issues:
-
In all
READMEandroxygenexamples, the argumentoutline.colorwas written asoutline.col, which createdwarningsinRStudioscripts about the partial matching of arguments. Fixed that. -
Styled the code in
tidyversestyle guide (both inRscript andREADMEfile). -
Added spelling tests to make sure no spelling error fall through the cracks.
-
Bumped up the package version to highlight that this is the development version. Added a few more badges to
READMEto convey the same thing. -
The
digitsargument (introduced in #12) wasn't working properly (IndrajeetPatil/ggstatsplot#93). This is now fixed. Also added an example to show that this works.
- When
insig = "blank"correlation labels are no longer displayed for insignificant correlations (@axitamm, #17)
-
New argument
digitsadded toggcorrplot()(@IndrajeetPatil, #12. -
New argument ggtheme added to
ggcorrplot()(@IndrajeetPatil, #11.
-
Bug fix for label argument inside ggplot2::geom_text (@alekrutkowski, #1)
-
Now
ggcorrplot()when both reshape and reshape2 packages are loaded (#4)
-
ggcorrplot(): visualize a correlation matrix
-
cor_pmat(): compute a correlation matrix p-values