当前位置:网站首页>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)
What is the relationship between digital transformation of manufacturing industry and lean production
Thanos Receiver
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
Principle of scalable contract delegatecall
抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
TIPC addressing 2
由粒子加速器产生的反中子形成的白洞
Multi line display and single line display of tqdm
随机推荐
vant tabs组件选中第一个下划线位置异常
TIPC introduction 1
基于Hardhat和Openzeppelin开发可升级合约(二)
TIPC messaging3
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
亚马逊云科技 Community Builder 申请窗口开启
Verilog 和VHDL有符号数和无符号数相关运算
CentOS8之mysql基本用法
Develop scalable contracts based on hardhat and openzeppelin (II)
A white hole formed by antineutrons produced by particle accelerators
Writing contract test cases based on hardhat
Tick Data and Resampling
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
ctf 记录
基于Hardhat编写合约测试用例
预言机链上链下调研
Basic usage of MySQL in centos8
Never forget, there will be echoes | hanging mirror sincerely invites you to participate in the opensca user award research
mmrotate旋转目标检测框架使用记录
php 根据经纬度查询距离