Repository navigation
Conversation
The NOTE: for transKeepSign was cut off in the roxygen block, so the reference manual explained neither what the argument does when FALSE nor what the rescaling actually is. Describe both rescalings: TRUE divides by max(abs(col.lim)) and keeps zero at the middle of the palette; FALSE spreads the palette linearly over col.lim. Note that the value-based methods (circle, square, ellipse, shade, pie) are rejected when the sign is dropped, and that a matrix with a single sign is always rescaled linearly over col.lim. Add an example illustrating the two modes, a regression test for the documented behaviour, and a NEWS entry.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The documentation for
transKeepSignwas cut off mid-sentence — the manualended at
NOTE: If FALSE, the non-corr matrix will be, which is where theroxygen block in
R/corrplot.Ralso stops. So the argument was documented bya sentence that never finished.
This replaces the note with an actual description:
transKeepSign = TRUE(default), values are divided bymax(abs(col.lim)). They keep their sign and zero stays at the midpoint ofthe palette, so a diverging palette is centred on zero just as it is for a
correlation matrix. This is the one to use when zero is a meaningful
reference (differences, log ratios, z-scores).
transKeepSign = FALSE, values are rescaled linearly so thatcol.lim[1]takes the first colour andcol.lim[2]the last: the wholepalette is used over the whole range, at the cost of zero no longer sitting
in the middle. A sequential palette usually fits better there.
value-based methods (
circle,square,ellipse,shade,pie) arerejected when the sign is dropped, because the rescaled values are all
non-negative; and a matrix whose values are all positive or all negative is
always rescaled linearly over
col.lim, whatever the flag says.No behaviour changes — documentation and tests only.
Files touched
R/corrplot.R,man/corrplot.Rd— the rewritten argument description, plusan example that plots a non-correlation matrix with
col.lim = c(-8, 8)both ways.
vignettes/example-corrplot.R— the same example for the vignette.tests/testthat/test-corrplot.R— regression test for the documentedbehaviour: value-keeping with
TRUE,(x - col.lim[1]) / diff(col.lim)withFALSE, the error for glyph methods withFALSE, and the identity for asingle-sign matrix.
NEWS.md— entry under the development version.Checks
(The 8 skips are pre-existing empty test files.)
Fixes #287.