当前位置:网站首页>HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
2022-07-02 11:50:00 【Xiaoyu 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)
边栏推荐
- Develop scalable contracts based on hardhat and openzeppelin (I)
- The computer screen is black for no reason, and the brightness cannot be adjusted.
- PHP 2D and multidimensional arrays are out of order, PHP_ PHP scrambles a simple example of a two-dimensional array and a multi-dimensional array. The shuffle function in PHP can only scramble one-dim
- SSRF
- Some things configured from ros1 to ros2
- R HISTOGRAM EXAMPLE QUICK REFERENCE
- TDSQL|就业难?腾讯云数据库微认证来帮你
- deepTools对ChIP-seq数据可视化
- 【2022 ACTF-wp】
- 通讯录的实现(文件版本)
猜你喜欢

Basic usage of MySQL in centos8

2022年4月17日五心红娘团队收获双份喜报

How to Visualize Missing Data in R using a Heatmap

HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R

Seriation in R: How to Optimally Order Objects in a Data Matrice

BEAUTIFUL GGPLOT VENN DIAGRAM WITH R

Dynamic memory (advanced 4)

GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT

Pyqt5+opencv project practice: microcirculator pictures, video recording and manual comparison software (with source code)

Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
随机推荐
揭露数据不一致的利器 —— 实时核对系统
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
Mmrotate rotation target detection framework usage record
QT meter custom control
文件操作(详解!)
PYQT5+openCV项目实战:微循环仪图片、视频记录和人工对比软件(附源码)
Webauthn - official development document
Map set assignment to database
Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
Data analysis - Matplotlib sample code
ROS lacks xacro package
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
Summary of flutter problems
程序员成长第六篇:如何选择公司?
The computer screen is black for no reason, and the brightness cannot be adjusted.
Attribute acquisition method and operation notes of C # multidimensional array
Take you ten days to easily finish the finale of go micro services (distributed transactions)
YYGH-BUG-04
Installation of ROS gazebo related packages
SSRF
