【问题标题】:drawing scatterplot 3D in r在 r 中绘制 3D 散点图
【发布时间】:2014-09-03 11:14:50
【问题描述】:

我想在 scatterplot3d 中可视化我的数据

在我的 X 和 Y 轴上,我想要相同的标签。像这样的:

x<-c("A","B","C","D")
y<-c("A","B","C","D")

在 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) 

现在我想在scatterplot3d 上绘制所有这些信息。如何在 scatterplot3d 上实现这个概念?

【问题讨论】:

  • xy 之间有 16 种组合(不是 10 种),所以我不明白你在问什么
  • A with BB with A相同。我已经发布了我的帖子
  • 为什么是-1?然后我可以更新我的帖子

标签: r plot visualization scatter-plot scatter3d


【解决方案1】:

如果要绘制点,则需要匹配 (x,y,z) 值的三元组。您可以创建与z 中的位置匹配的xy

xx <- factor(rep(x, 4:1), levels=x)
yy <- factor(unlist(sapply(1:4, function(i) y[i:4])), levels=y)

然后你就可以画出情节了

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))

得到

但老实说,这似乎不是一个特别有效的可视化。

【讨论】:

    猜你喜欢
    • 2021-05-14
    • 2017-04-29
    • 1970-01-01
    • 2021-04-07
    • 1970-01-01
    • 2016-04-28
    • 2022-01-02
    • 1970-01-01
    • 2021-10-29
    相关资源
    最近更新 更多