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

Added 'as.is' passed to reshape2::melt.array(). #24

Merged
merged 1 commit into from Oct 2, 2019
Merged

Added 'as.is' passed to reshape2::melt.array(). #24

merged 1 commit into from Oct 2, 2019

Conversation

fdetsch
Copy link
Contributor

@fdetsch fdetsch commented Aug 29, 2019

Numeric-style dimnames (see sample data) are currently being converted to numeric by reshape2::melt.array(). Since this is not always desirable, I believe a customization option should be made available to the user.

In my particular case, dimnames '01' to '12' are sample names that I want to appear as categorical rather than continuous features in the resulting plot. Current behavior:

out_tt1.1 = readRDS("C:/Users/florianD/Downloads/out_tt1.1.rds")

ggcorrplot::ggcorrplot(out_tt1.1, type = "upper", p.mat = out_tt1.1
                       , show.diag = TRUE) + 
  scale_fill_gradient2(bquote(bold("p-value")), limit = c(0, 1), midpoint = 0.5
                       , low = "#460000", high =  "#EBEAF7", mid = "#B5BD4C")

current

With adjustments:

ggcorrplot::ggcorrplot(out_tt1.1, type = "upper", p.mat = out_tt1.1
                       , show.diag = TRUE, as.is = TRUE) + 
  scale_fill_gradient2(bquote(bold("p-value")), limit = c(0, 1), midpoint = 0.5
                       , low = "#460000", high =  "#EBEAF7", mid = "#B5BD4C")

adjusted

@kassambara
Copy link
Owner

Thank you for pointing this out! In correlation matrix plot, the axis texts should always be considered as character not continuous variable. Therefore, I think that we should, internally, specify as.is = TRUE in reshape2::melt(), without adding extra argument to ggcorrplot()

@fdetsch
Copy link
Contributor Author

fdetsch commented Aug 30, 2019

In general, I agree. However, I thought that for reasons of backward compatibility (ie. in the unlikely event that a user really wanted to have numeric axes), it would be a good idea to add a separate argument. Your call!

@kassambara kassambara merged commit 7909786 into kassambara:master Oct 2, 2019
@kassambara
Copy link
Owner

merged now, thanks

kassambara added a commit that referenced this pull request Oct 2, 2019
@fdetsch
Copy link
Contributor Author

fdetsch commented Oct 4, 2019

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants