的R - 序列的颜色和标签问题hist3D [英] R - hist3D of sequence colour and label issues
问题描述
所以我有5行20列的数据集。
我想绘制 hist3D
从 PLOT3D
包。
So I have a dataset with 5 rows and 20 columns.
I am trying to plot a hist3D
from the plot3D
package.
dt = structure(c(1, 1, 1, 3, 1, 2, 1, 0, 2, 1, 2, 1, 0, 1, 1, 0, 1,
0, 2, 2, 1, 1, 1, 1, 4, 4, 1, 1, 2, 3, 8, 1, 1, 2, 1, 10, 0,
1, 2, 1, 9, 0, 2, 4, 0, 4, 0, 5, 2, 2, 2, 0, 1, 2, 4, 1, 1, 3,
2, 6, 8, 1, 2, 2, 4, 10, 0, 2, 2, 4, 7, 0, 7, 1, 4, 11, 0, 4,
1, 2, 15, 0, 4, 2, 3, 16, 2, 7, 2, 2, 18, 3, 9, 0, 1, 15, 0,
15, 0, 2), .Dim = c(5L, 20L), .Dimnames = list(c("f Housework",
"g Odd jobs", "h Eating", "i Child care", "j Care for others"
), c("V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10",
"V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19",
"V20")))
直方图
hist3D(x = 1:5, z = dt, scale = T, col = jet.col(100, alpha = 0.3), add = F, colkey = F, ticktype = "detailed")
我想是
-
替换x轴(1:5)由row.names(F家务, G兼职,H吃,我托儿,J关怀他人 )
replace the x-axis (1:5) by the row.names ("f Housework", "g Odd jobs", "h Eating", "i Child care", "j Care for others" )
X 变量,行我的数据,(1:5,F家务, G兼职,H吃,我托儿,J关怀他人), 我想对每个行的不同颜色(如果可能不同的热图序列颜色)。
Instead of having the same colours for each x variables, the rows of my data, (1:5, "f Housework", "g Odd jobs", "h Eating", "i Child care", "j Care for others"), I would like to have for each rows a different colour (if possible a different "heat-map" sequence colours).
我想是这样的(手动平局我知道):
What I would like is something like this (manual draw I know) :
有什么建议?
推荐答案
我觉得我对颜色的解决方案:
I think I have a solution for the colors:
m <- matrix(rep(seq(5),each=20), ncol=20, nrow=5, byrow = TRUE)
hist3D(x = 1:5, z = dt, scale = T, col = jet.col(5, alpha = 0.3), add = F, colvar = m, colkey = T, ticktype = "detailed")
我会尽快,因为我找到了如何修改x轴标签更新帖子。
I will update the post as soon as I find out how to modify the x-axis labels.
这篇关于的R - 序列的颜色和标签问题hist3D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!