当前位置:网站首页>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)
边栏推荐
猜你喜欢

Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?

【云原生】2.5 Kubernetes 核心实战(下)

Solve the problem of data blank in the quick sliding page of the uniapp list

从攻击面视角,看信创零信任方案实践

tqdm的多行显示与单行显示

PKG package manager usage instance in FreeBSD

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

八大排序汇总

A sharp tool for exposing data inconsistencies -- a real-time verification system

抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
随机推荐
JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
RPA进阶(二)Uipath应用实践
制造业数字化转型和精益生产什么关系
MTK full dump grab
TIPC Getting Started6
MySQL比较运算符IN问题求解
对毕业季即将踏入职场的年轻人的一点建议
The difference between SQL left join main table restrictions written after on and where
flutter 问题总结
Tick Data and Resampling
Redis超出最大内存错误OOM command not allowed when used memory &gt; 'maxmemory'
TDSQL|就业难?腾讯云数据库微认证来帮你
2022年4月17日五心红娘团队收获双份喜报
js中给数组添加元素的方法有哪些
Bedtools tutorial
PX4 Position_Control RC_Remoter引入
Functional interfaces and method references
String (Analog
2022年遭“挤爆”的三款透明LED显示屏
Principe du contrat évolutif - delegatecall
