Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotted NAs should be different from zeroes #46

Closed
vsimko opened this issue Mar 16, 2016 · 1 comment
Closed

Plotted NAs should be different from zeroes #46

vsimko opened this issue Mar 16, 2016 · 1 comment
Assignees
Labels

Comments

@vsimko
Copy link
Collaborator

vsimko commented Mar 16, 2016

As pointed out by @taiyun we should distinguish between 0 and NA in the plot.

It is not a good idea that plot nothing if a cell value is NA:

M1 = M2 = cor(mtcars)
diag(M1) = 0
diag(M2) = NA

# should not be the same
corrplot(M1) 
corrplot(M2) 

How about using '?' instead ?

@vsimko vsimko added the feature label Mar 16, 2016
vsimko added a commit to vsimko/corrplot that referenced this issue Mar 16, 2016
- added parameters `na.label` and `na.label.col`
vsimko added a commit to vsimko/corrplot that referenced this issue Mar 16, 2016
vsimko added a commit to vsimko/corrplot that referenced this issue Mar 16, 2016
vsimko added a commit to vsimko/corrplot that referenced this issue Mar 16, 2016
vsimko added a commit to vsimko/corrplot that referenced this issue Mar 16, 2016
vsimko added a commit that referenced this issue Mar 16, 2016
@vsimko
Copy link
Collaborator Author

vsimko commented Mar 16, 2016

Now it is possible to use parameters na.label and na.label.col to generate NA values differently from zeroes.

Here are some examples:

M <- cor(mtcars)
diag(M) <- NA
M[4,2] <- NA
# default with questionmarks
corrplot(M)

image

# black square instead of the label
corrplot(M, na.label = "square", na.label.col = "black")

image

# large matrix with some NAs on diagonal and a rectangle of zeros in the middle
M <- matrix(runif(10000, 0.5, 1), nrow = 100)
M[40:50,30:70] <- 0
diag(M) <- NA
corrplot(M, method = "color", cl.pos = "n", tl.pos = "n",
         na.label = "square", addgrid.col = NA)

image

@vsimko vsimko closed this as completed Mar 16, 2016
@vsimko vsimko self-assigned this Mar 16, 2016
@vsimko vsimko mentioned this issue Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant