Row labels not showing in heatmap using Heatmaply

孤人 提交于 2020-01-07 04:43:07

问题


I am using heatmaply to create a heatmap but unfortunately my row labels are not showing as names. Row labels are row numbers. How can I make my row names from column 1 show on the heatmap ?

Here is my code:

the row names are still not showing as labels, but rather as numbers (1,2,3...):

heatmaply(mtcars, k_col =10, k_row =1, row.names(mtcars) <- mtcars[,1], cexRow = 0.1, cexCol=10, margins =c(100,100))

Please advise Thanks


回答1:


I don't know what your heatmap should look like (I could not generate a map with the code you provided). However, I was able to generate a graph with the row labels (Mazda RX4, etc.) by simply removing row.names from your code:

heatmaply(mtcars, k_col =10, k_row =1, cexRow = 0.1, cexCol=10, margins =c(100,100))



回答2:


Well the secret is using labRow= cars[,1] in the code as follows:

heatmaply(cars, k_col=14, k_row=1,labRow= cars[,1], cexRow=10, cexCol=10, margins=c(50,50), scale_fill_gradient_fun=ggplot2::scale_fill_gradient2(low="navy blue", high ="red",midpoint=1, limits=c(0,2.2)))



来源:https://stackoverflow.com/questions/45226420/row-labels-not-showing-in-heatmap-using-heatmaply

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!