I want each variable only once from correlation graph

20 views Asked by At

I am using this code to make a correlation graph: This is a dummy example where I want to have a correlation graph. For this, I have used the R script below: From this script, I am getting this classic graph where Soil_N, Soil_P, Soil_S, Soil_K, and Soil_pH are on both sides of the correlation graph.

However, I would like to have a graph where on one axis I have only Soil_N and Soil_P, and on the other axis, I have Soil_S, Soil_K, Soil_pH. I have attached a reference picture for how I might want my graph to be. I am sure that there is something very minor I have to edit but I have spent 3 hours finding this out without any success. Any quick help will be appreciated!

  Soil_P = c(2, 2, 1, 3, 4, 8, 8, 9, 7, 6, 11, 12, 11, 10, 10, 18, 18, 17, 21, 19),
  Soil_S = c(100,110, 100, 101, 99, 87, 89, 88, 88, 87, 66, 67, 67, 68, 65, 44, 44, 43, 45, 45),
  Soil_K =c(1, 2, 1, 1, 1, 3, 3, 4, 3, 3, 6, 7, 6, 7, 6, 9, 9, 9, 9, 10), 
  Soil_pH = c(7, 7, 7.1, 7.2, 7.1, 5, 5.1, 5.3,5.4,5.3, 5.3, 3.2, 3.4, 3.2, 3.1, 3, 8, 8.2, 8.9, 8.7) ```


``` res <- cor.mtest(as.data.frame(d), conf.level = 0.95)
m<- cor(d)
corrplot(m, is.corr=FALSE, method="square", type = "upper",
         tl.srt=65, tl.cex=0.95, number.cex=0.8, tl.col='black', cl.length= 5, cl.align="l") ```
0

There are 0 answers