R热图,Y轴上的标签非常接近 [英] R Heat Map , Labels on Y axis coming out to be very close

查看:93
本文介绍了R热图,Y轴上的标签非常接近的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R在CSV文件(10(列)条件和1000(Rowa))中绘制数据的热图

I am using R to plot the heat map of a data in CSV file (10 (Columns) Conditions and 1000 (Rowa))

以下是我正在使用的代码..

Following is the Code I am using ..

nba <- read.csv("1317754115.csv", sep=",")
nba_matrix <- data.matrix(nba)
cexRow = 0.2 + 1/log10(1000),
cexCol = 0.2 + 1/log10(10),
nba_heatmap <- heatmap(nba_matrix, Rowv=cexRow, Colv=cexCol, 
    col = heat.colors(256), scale="column", margins=c(5,10))

热图图像

现在右侧的行非常接近,因此我无法读取标签名称

Now Rows on right hand sides are very close so I can not read the label names ,

有人可以告诉我如何在Y轴上显示所有标签

Can some one please tell me how can i show all labels on Y-Axis

谢谢

推荐答案

您不能使用基本的heatmap函数更改宽高比.要获得此功能,请参见gplots程序包中的heatmap.2ClassDiscovery程序包中的aspectHeatmap.这是一个示例:

You can't change the aspect ratio with the base heatmap function. To get this functionality, see heatmap.2 in the gplots package, or aspectHeatmap in the ClassDiscovery package. Here's an example:

require(gplots)

nrow = 100
ncol = 10

set.seed(12345)
row.names = replicate(nrow, paste(letters[sample(10)], collapse=''))
col.names = replicate(ncol, paste(letters[sample(10)], collapse=''))

values = matrix(runif(nrow*ncol), nrow=nrow, dimnames=list(row.names, col.names))

dev.new(width=5, height=10)
heatmap(values)
dev.new(width=5, height=10)
heatmap.2(values)

这篇关于R热图,Y轴上的标签非常接近的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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