相关矩阵的热图或图 [英] Heatmap or plot for a correlation matrix

查看:159
本文介绍了相关矩阵的热图或图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用相关矩阵绘制一个图,并使用库格用三种颜色来表示相关系数.

I tried to make a plot out of the correlation matrix and having three colours to represent the correlation coefficients using the library lattice.

library(lattice)

levelplot(cor)

我得到以下图:

该图仅适用于我拥有的数据的子集.当我使用整个数据集(400X400)时,它变得不清楚,并且颜色显示不正确,并显示为点.对于大型矩阵,是否有可能以图块的形式获得相同的图像?

The plot is only for a subset of the data I had. When I use the whole dataset( 400X400) then it becomes unclear and the colouring is not shown properly and is shown as dots. Is it possible to obtain the same in tile form for a large matrix?

我尝试使用pheatmap函数,但是我不希望我的值被聚类,而只是希望以平铺形式清楚地表示高值和低值.

I tried using the pheatmap function but I do not want my values to be clustered and just want a representaion of high and low values clearly in a tile form.

推荐答案

@Lucas在此处提供了很好的建议,因为corrplot对于可视化相关矩阵非常有用.但是,它没有解决绘制大相关矩阵的原始问题.实际上,当试图可视化如此大的相关矩阵时,corrplot也将失败.对于一个简单的解决方案,您可能要考虑减少变量的数量.也就是说,我建议查看您知道对您的问题很重要的变量子集之间的相关性.试图了解许多变量的相关结构将是一项艰巨的任务(即使您可以将其可视化)!

@Lucas provides good advice here as corrplot is quite useful for visualizing correlation matrices. However, it doesn't address the original issue of plotting a large correlation matrix. In fact, corrplot will also fail when trying to visualize this large of a correlation matrix. For a simple solution, you might want to consider reducing the number of variables. That is, I would suggest looking at the correlation between a subset of variables that you know are important for your problem. Trying to understand the correlation structure of that many variables will be a difficult task (even if you can visualize it)!

这篇关于相关矩阵的热图或图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆