Comments (1)
After trying simply commenting out that one line in the ggcorr
function, I now know that 0s are replaced by NA to get the upper triangle of the correlation plot to be empty. As a fix for myself, I tried the following.
#m <- data.frame(m * lower.tri(m))
# replace above with this:
m[upper.tri(m, diag = T)] <- NA
rownames(m) <- colnames(m)
# need to make it a dataframe:
m <- data.frame(m)
m$.ggally_ggcorr_row_names <- rownames(m)
# m = reshape::melt(m, id.vars = ".ggally_ggcorr_row_names")
# names(m) = c("x", "y", "coefficient")
m_long <- m %>%
tidyr::pivot_longer(
cols = -.ggally_ggcorr_row_names,
names_to = "y",
values_to = "coefficient"
) %>%
dplyr::rename(x = .ggally_ggcorr_row_names) %>%
dplyr::mutate(y = factor(y, levels = rownames(m)))
#m_long$coefficient[m_long$coefficient == 0] <- NA
This works for me, but I'm not a great R programmer, so if someone else has a more elegant solution please use that instead.
Edited to add:
Could I also suggest using label = format(label, nsmall = label_round)
in several places in the ggcorr
function to ensure that rounding is consistent (e.g., "0.00" shows up as "0.00" not "0")?
from ggally.
Related Issues (20)
- Example case in documentation is using deprecated features
- ggscatmat: wrong faceting with ncol > 9
- cannot coerce type 'closure' to vector of type 'character' HOT 1
- Allow parallel sets into parallel coordinates? HOT 1
- Migrate off reshape? HOT 5
- Release GGally 2.2.0 HOT 1
- ggcorr() suggestion, add option to provide custom labels for the variables
- ggally_cor errors out if number of samples is less than 3 rather than returning NA
- failure in basic ggpairs example with GGally 2.20/ggplot2 3.4.4.9000/r-devel
- The custom functions don't Work in GGally HOT 1
- ggally_cor: argument "use" is meaningless
- Test suite error: could not find function "asIgraph" HOT 3
- Adding legend to ggpairs
- Release GGally 2.2.1
- `order = "anyClass"` argument of `ggparcoord()` function doesn't work when the dataset has missing values
- Proposal for Implementing ggcall into GGally for Enhanced Plot Reproducibility
- Make `ggparcoord` (and helper methods) into a separate package HOT 4
- ggpairs Documentation Doesn't Mention hexbin Option
- Support color mapping for continuous variable in scatter plots
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggally.