当前位置:网站首页>HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
2022-07-02 09:38:00 【小宇2022】
df <- mtcars
library(heatmaply)
heatmaply_cor(
cor(df),
xlab = "Features",
ylab = "Features",
k_col = 2,
k_row = 2
)

df <- mtcars
library(heatmaply)
# Compute correlation coefficients
cor.coef <- cor(df)
# Compute correlation p-values
cor.test.p <- function(x){
FUN <- function(x, y) cor.test(x, y)[["p.value"]]
z <- outer(
colnames(x),
colnames(x),
Vectorize(function(i,j) FUN(x[,i], x[,j]))
)
dimnames(z) <- list(colnames(x), colnames(x))
z
}
p <- cor.test.p(df)
heatmaply_cor(
cor.coef,
node_type = "scatter",
point_size_mat = -log10(p),
point_size_name = "-log10(p-value)",
label_names = c("x", "y", "Correlation")
)

library(ggcorrplot)
# Compute a correlation matrix
corr <- round(cor(df), 1)
# Compute a matrix of correlation p-values
p.mat <- cor_pmat(df)
# Visualize the lower triangle of the correlation matrix
# Barring the no significant coefficient
corr.plot <- ggcorrplot(
corr, hc.order = TRUE, type = "lower", outline.col = "white",
p.mat = p.mat
)
corr.plot

library(ggcorrplot)
library(plotly)
# Compute a correlation matrix
corr <- round(cor(df), 1)
# Compute a matrix of correlation p-values
p.mat <- cor_pmat(df)
# Visualize the lower triangle of the correlation matrix
# Barring the no significant coefficient
corr.plot <- ggcorrplot(
corr, hc.order = TRUE, type = "lower", outline.col = "white",
p.mat = p.mat
)
ggplotly(corr.plot)
边栏推荐
猜你喜欢

I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)

Tick Data and Resampling

Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting

TDSQL|就业难?腾讯云数据库微认证来帮你

Redis超出最大内存错误OOM command not allowed when used memory &gt; 'maxmemory'

Mmrotate rotation target detection framework usage record

Principe du contrat évolutif - delegatecall

Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'

ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘

Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
随机推荐
The working day of the month is calculated from the 1st day of each month
What is the relationship between digital transformation of manufacturing industry and lean production
C#多维数组的属性获取方法及操作注意
Some suggestions for young people who are about to enter the workplace in the graduation season
MySQL比较运算符IN问题求解
Verilog and VHDL signed and unsigned number correlation operations
ASTParser 解析含有emum 枚举方法的类文件的踩坑记
Jinshanyun - 2023 Summer Internship
JS -- take a number randomly from the array every call, and it cannot be the same as the last time
bedtools使用教程
Map set assignment to database
III Chip startup and clock system
ctf 记录
String (Analog
八大排序汇总
spritejs
MTK full dump grab
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
Tdsql | difficult employment? Tencent cloud database micro authentication to help you
