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

对于相关性热图希望能出新品,(附代码) #773

Open
Miachol opened this issue Aug 22, 2024 · 0 comments
Open

对于相关性热图希望能出新品,(附代码) #773

Miachol opened this issue Aug 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Miachol
Copy link
Member

Miachol commented Aug 22, 2024

Contact: Zeng menders / [email protected]
本人是R的小白一个,有代码但是不会修改数值,不会用,望能开发出能够简易操作的项目,以下是代码:

library(ggcor)
library(dplyr)
library(ggplot2)
#> Warning: package 'dplyr' was built under R version 3.6.2
data("varechem", package = "vegan")
data("varespec", package = "vegan")

mantel <- mantel_test(varespec, varechem,

  •                   spec.select = list(Spec01 = 1:7,
    
  •                                      Spec02 = 8:18,
    
  •                                      Spec03 = 19:37,
    
  •                                      Spec04 = 38:44)) %>% 
    
  • mutate(rd = cut(r, breaks = c(-Inf, 0.2, 0.4, Inf),
    
  •                 labels = c("< 0.2", "0.2 - 0.4", ">= 0.4")),
    
  •        pd = cut(p.value, breaks = c(-Inf, 0.01, 0.05, Inf),
    
  •                 labels = c("< 0.01", "0.01 - 0.05", ">= 0.05")))
    

quickcor(varechem, type = "upper") +

  • geom_square() +
    
  • anno_link(aes(colour = pd, size = rd), data = mantel) +
    
  • scale_size_manual(values = c(0.5, 1, 2)) +
    
  • scale_colour_manual(values = c("#D95F02", "#1B9E77", "#A2A2A288")) +
    
  • guides(size = guide_legend(title = "Mantel's r",
    
  •                            override.aes = list(colour = "grey35"), 
    
  •                            order = 2),
    
  •        colour = guide_legend(title = "Mantel's p", 
    
  •                              override.aes = list(size = 3), 
    
  •                              order = 1),
    
  •        fill = guide_colorbar(title = "Pearson's r", order = 3))
    

——————————
以上是代码,望开发

@Miachol Miachol added the enhancement New feature or request label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant