丑到怀疑人生的相关性热图

丑到怀疑人生的相关性热图_第1张图片

先做个记录后面再改吧。
# Load the 'corrplot' package
library(corrplot)
 

# Load data from a text file called 'AR19_Ex1_corrplot.txt'
plotCorMat <- read.table('demo.txt', header = TRUE, row.names = 1, stringsAsFactors = FALSE)

# Rename row and column names for the correlation matrix
rownames(plotCorMat) <- c("OS","HM2",
                          "BS",
                          "HI1",
                          "HI2",
                          "HAa",
                          "HAb",
                          "HAr")
colnames(plotCorMat) <- c("OS","HM2",
                          "BS",
                          "HI1",
                          "HI2",
                          "HAa",
                          "HAb",
                          "HAr")

# Create a PDF file to save the correlation plot
pdf(file = "demo.pdf", width = 10, height = 9)

# Generate the correlation plot using the 'corrplot' function without specifying 'method'
corrplot.mixed(as.matrix(plotCorMat),
         lower = 'pie',
         upper = 'circle',
        # col.lim = c(0,0.05),
         tl.cex = 0.85,
         cl.cex = 0.85,
         diag="n",
         tl.col="black",
         upper.col = c("#4f953b", "#56A902", "#77C034", "#8CD790","#C388FE", "#791E94", "#001219","#9B2226", "#AE2021", "#BB3E03", "#CA6702", "#90e0ef", "#0077b6", "#023e8a"),
         lower.col = c("#C388FE", "#791E94", "#001219", "#9B2226","#AE2021", "#BB3E03", "#CA6702", "#90e0ef", "#0077b6", "#023e8a","#4f953b", "#56A902", "#77C034", "#8CD790"))

#46# Close the PDF device to save the plot
dev.off()


你可能感兴趣的:(开发语言,python)