[英]drawing scatterplot 3D in r
I would like to visualize my data in a scatterplot3d 我想在scatterplot3d中可视化我的数据
On my X and Y axis, I would like the same lables. 在我的X和Y轴上,我想要相同的标签。 Something like this:
像这样:
x<-c("A","B","C","D")
y<-c("A","B","C","D")
on the Z axis, I would like to show the comparision between lables in X and Y 在Z轴上,我想展示X和Y上的标签之间的比较
A with A
A with B
A with c
A with D
B with B
B with C
B with D
C with C
C with D
D with D
#altogether 10 values in Z
z<-c(0.25, 0.7, 0.35, 1.14, 0.85, 0.36, 0.69, 0.73, 0.023, 0.85)
Now I want to draw all of of these infos on scatterplot3d
. 现在,我想在
scatterplot3d
上绘制所有这些信息。 How can I implement this concept on scatterplot3d? 如何在scatterplot3d上实现此概念?
If you want to plot points, you need to match triplets of (x,y,z)
values. 如果要绘制点,则需要匹配
(x,y,z)
值的三元组。 You can create x
and y
values matching the positions in z
with 您可以使用以下命令创建与
z
的位置匹配的x
和y
值
xx <- factor(rep(x, 4:1), levels=x)
yy <- factor(unlist(sapply(1:4, function(i) y[i:4])), levels=y)
Then you can draw the plot with 然后你可以用
library(scatterplot3d)
scatterplot3d(xx,yy,z,
x.ticklabs=c("",x,""), y.ticklabs=c("",y,""),
type="h", lwd=2,
xlim=c(0,5), ylim=c(0,5))
to get 要得到
But honestly this doesn't seem like a particularly effective visualization. 但老实说,这似乎并不是一种特别有效的可视化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.