I have used corrplot
package to plot my data-pairs. But all the relationships in my data are positive.
Mydata<-read.csv("./xxxx.csv")
M <-cor(Mydata)
corrplot(M,,col=rev(brewer.pal(n=8, name="RdYlBu")))
Using ggcorr
, I also can't find any solution to deal with the issue.
How to generate a user-defined colormap with the corresponding range from 0 to 1?
If you are trying to map the entire range of the colormap to only the positive correlations, you could use
col = rep(rev(brewer.pal(n=8, name="RdYlBu")), 2)
. This repeats the color sequence, and thencl.lim = c(0,1)
forces corrplot to use only the 2nd half of the sequence, mapped to the range 0 to 1.Some reproducible data