Skip to content

ggcorrplot 0.3.0

Latest

Choose a tag to compare

@kassambara kassambara released this 24 Jul 21:17
· 4 commits to master since this release
b25991c

New features

  • New argument cell.grid to draw a light rectangle around every cell (behind
    the glyphs) and drop the through-center gridlines, so the sized glyphs
    (method = "circle" or scale.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 argument
    cell.grid.col (default "grey90"). Defaults to FALSE; has no effect on a
    full-tile square heatmap, whose tiles already carry an outline.color border.

  • New argument scale.square to size the squares by the absolute correlation
    when method = "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 to FALSE (constant full-cell
    squares, unchanged); has no effect for method = "circle" (circles are always
    sized).

  • New argument preset for 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 to NULL (no preset), leaving existing calls
    unchanged.

  • New argument palette to 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 out colors.
    Defaults to NULL (use colors), 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, not
    sig.level) instead of crossing out the
    insignificant ones. Works without lab, so ggcorrplot(corr, p.mat = p.mat, insig = "stars") is a standalone significance map. The default insig = "pch"
    is unchanged.

  • New arguments lower.method and upper.method for 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 to NULL, leaving the
    single-method output unchanged (#85). Requested by @Breeze-Hu.

  • New argument hc.rect to 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 to
    NULL (no rectangles). The rectangle outline color is set with the companion
    argument hc.rect.col (default "gray30", e.g. hc.rect.col = "white").

Main changes

  • The plot axis is now always drawn in the matrix (row/column) order. This fixes
    a bug where hc.order = TRUE was silently ignored for correlation matrices with
    numeric-looking variable names (e.g. "1", "2", ...): reshape2::melt
    type-converted such names to a continuous axis sorted by value, discarding the
    clustering order (#37). As a consequence, the as.is argument no longer affects
    the plot (it is kept only for backward compatibility) -- a call using
    as.is = TRUE, which previously produced an alphabetically-ordered axis, now
    follows the matrix order like every other call. Reported by @cabaez (#37).

  • show.diag = FALSE on 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
    wiped min(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).

Minor changes

  • 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.