如何在 R 中绘制 3D 堆叠直方图?
我想在 R 中绘制堆积直方图;即在三维空间中堆叠各个直方图。
感谢大家的建议,尤其是 Shane 的建议。
@hadley,我同意你的观点,但是,我的情况有所不同:我试图通过绘制四个堆叠直方图来传达的要点是尾部变化很大......将被遮挡的部分没有任何后果在我提供的数据中......此外,能够读取频率轴也不重要,因为我将绘制相对频率......
I want to plot stacked histograms in R; i.e. stack individual histograms in the third dimension.
thank you all for your suggestions, especially the one by Shane.
@hadley, I agree with your points, however, my situation is different: the main point I'm trying to convey by plotting four stacked histograms is that the tails vary significantly....the part that will get obscured is of no consequence in the data I'm presenting....also, being able to read the frequency axis is also not important since I'll be plotting the relative frequencies...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个没有。这是一个糟糕的数据显示,因为前面的直方图掩盖了后面的直方图,并且透视图使得几乎不可能读取 y 轴上的值。
One doesn't. This is a terrible display of data because the front histograms obscure the rear histograms and the perspective makes it just about impossible to read the values off the y-axis.
您可以尝试使用
rgl
(参见此处)或3dscatterplot
(如在此示例中)。 Lattice 也支持这一点:您可以看到一个示例 学习者博客。
我不认为这在技术上是一个堆叠直方图(堆叠直方图将条形堆叠在一起)。此外,不同类型的直方图可能会提供更多信息:查看 the
ggplot2
此处的文档 提供了一些示例。另一种选择是使用网格,在 ggplot2 中使用
facet_wrap
(参见 以这篇文章为例)。You could try using either
rgl
(see here) or3dscatterplot
(as in this example). Lattice also supports this:You can see an example of this on the Learnr blog.
I don't believe that's technically a stacked histogram (a stacked histogram stacks the bars on top of each other). Moreover, a different kind of histogram could be more informative: look at the
ggplot2
the documentation here for some examples.Another option is to use latticing instead, with
facet_wrap
in ggplot2 (see this post as an example).