taiyun / corrplot

Compare c951351 ... +1 ... 0497ad6

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 5 files from the diff.
Other files ignored by Codecov
NEWS.md has changed.
DESCRIPTION has changed.
man/corrplot.Rd has changed.

@@ -42,6 +42,10 @@
Loading
42 42
#'   are still distributed uniformly in [-1, 1], it only affect the display
43 43
#'   on color-legend.
44 44
#'
45 +
#' @param is.corr Logical, whether the input matrix is a correlation matrix or
46 +
#'   not. We can visualize the non-correlation matrix by setting
47 +
#'   \code{is.corr = FALSE}.
48 +
#'
45 49
#'
46 50
#' @param bg The background color.
47 51
#'
@@ -99,15 +103,6 @@
Loading
99 103
#'   valid when \code{addrect} is equal or greater than 1.
100 104
#'
101 105
#'
102 -
#' @param is.corr Logical, whether the input matrix is a correlation matrix or
103 -
#'   not. We can visualize the non-correlation matrix by setting
104 -
#'   \code{is.corr = FALSE}.
105 -
#'
106 -
#' @param ignoreSign Logical, whether or not to ignore matrix values' sign when assigning colors
107 -
#’   for non-corr matrix.
108 -
#'   Only valid when \code{is.corr = FALSE}. The default value is \code{FALSE}.
109 -
#'
110 -
#'
111 106
#' @param tl.pos Character or logical, position of text labels. If character, it
112 107
#'   must be one of \code{'lt'}, \code{'ld'}, \code{'td'}, \code{'d'} or
113 108
#'   \code{'n'}. \code{'lt'}(default if \code{type=='full'}) means left and top,
@@ -169,6 +164,12 @@
Loading
169 164
#'
170 165
#' @param shade.col The color of shade line.
171 166
#'
167 +
#' @param transKeepSign Logical, whether or not to keep matrix values' sign when
168 +
#'   transforming non-corr matrix for plotting.
169 +
#'   Only valid when \code{is.corr = FALSE}. The default value is \code{TRUE}.
170 +
#'
171 +
#'   NOTE: If \code{FALSE},the non-corr matrix will be
172 +
#'
172 173
#' @param p.mat Matrix of p-value, if \code{NULL}, parameter \code{sig.level},
173 174
#'   \code{insig}, \code{pch}, \code{pch.col}, \code{pch.cex} are invalid.
174 175
#'
@@ -266,8 +267,8 @@
Loading
266 267
#' @export
267 268
corrplot = function(corr,
268 269
  method = c('circle', 'square', 'ellipse', 'number', 'shade', 'color', 'pie'),
269 -
  type = c('full', 'lower', 'upper'), col = NULL, col.lim = NULL, bg = 'white',
270 -
  title = '', add = FALSE,   diag = TRUE, outline = FALSE,
270 +
  type = c('full', 'lower', 'upper'), col = NULL, col.lim = NULL, is.corr = TRUE,
271 +
  bg = 'white',   title = '', add = FALSE, diag = TRUE, outline = FALSE,
271 272
  mar = c(0, 0, 0, 0),
272 273
273 274
  addgrid.col = NULL, addCoef.col = NULL, addCoefasPercent = FALSE,
@@ -277,8 +278,6 @@
Loading
277 278
                    'average', 'mcquitty', 'median', 'centroid'),
278 279
  addrect = NULL, rect.col = 'black', rect.lwd = 2,
279 280
280 -
  is.corr = TRUE, ignoreSign = FALSE,
281 -
282 281
  tl.pos = NULL, tl.cex = 1,
283 282
  tl.col = 'red', tl.offset = 0.4, tl.srt = 90,
284 283
@@ -290,6 +289,8 @@
Loading
290 289
  addshade = c('negative', 'positive', 'all'),
291 290
  shade.lwd = 1, shade.col = 'white',
292 291
292 +
  transKeepSign = TRUE,
293 +
293 294
  p.mat = NULL, sig.level = 0.05,
294 295
  insig = c('pch', 'p-value', 'blank', 'n', 'label_sig'),
295 296
  pch = 4, pch.col = 'black', pch.cex = 3,
@@ -327,6 +328,10 @@
Loading
327 328
    addgrid.col = switch(method, color = NA, shade = NA, 'grey')
328 329
  }
329 330
331 +
  if(!is.corr & !transKeepSign & method %in% c('circle', 'square', 'ellipse', 'shade', 'pie')) {
332 +
    stop("method should not be in c('circle', 'square', 'ellipse', 'shade', 'pie') when transKeepSign = FALSE")
333 +
  }
334 +
330 335
  # Issue #142
331 336
  # checks for all values that are not missing
332 337
  if (any(corr[!is.na(corr)] < col.lim[1]) || any(corr[!is.na(corr)] > col.lim[2])) {
@@ -389,15 +394,14 @@
Loading
389 394
      warning('col.lim interval too wide, please set a suitable value')
390 395
    }
391 396
392 -
    # all negative or positive or NOT keepSign, trans to [0, 1]
393 -
    if (c_max <= 0 | c_min>=0 | ignoreSign) {
397 +
    # all negative or positive or NOT transkeepSign, trans to [0, 1]
398 +
    if (c_max <= 0 | c_min>=0 | !transKeepSign) {
394 399
      intercept = - col.lim[1]
395 400
      zoom = 1 / (diff(col.lim))
396 401
397 -
398 -
      if(col.lim[1] * col.lim[2] < 0) {
399 -
        warning('col.lim interval not suitable to the matrix')
400 -
      }
402 +
      #if(col.lim[1] * col.lim[2] < 0) {
403 +
      #  warning('col.lim interval not suitable to the matrix')
404 +
      #}
401 405
402 406
    }
403 407

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R -0.15% 99.69%
Project Totals (9 files) 99.69%
Loading