使用R创建3D直方图 [英] Creating a 3D histogram with R
问题描述
如何使用R创建3D直方图?
How can I create a 3D histogram with R?
例如,我有两个变量要计入它们落入已定义的二维箱中的次数.因此,我在X和Y轴上有两个变量,而Z轴是这两个变量的计数.
For example, I have two variables to be counted for the number of times they fall in a defined two dimensional bin. So I have two variables in the X and Y axis, while the Z axis is the count of the two variables.
推荐答案
查看包hexbin进行计算和显示,例如ggplot的stat_bin2d
/stat_binhex
用于显示.您将获得2个空间坐标,这是您的屏幕或纸张可以完成的全部工作,再加上第3个颜色编码的尺寸.
have a look at package hexbin to calculate and display, or e.g. ggplot's stat_bin2d
/ stat_binhex
for display. You get 2 spatial coordinates which is all your screen or paper can do plus a 3rd, colour-coded dimension.
请注意如何绘制3D堆叠图R?中的直方图与该问题完全相同(但第3维在此处进行了空间讨论).
Note that How does one plot a 3D stacked histogram in R? is quite a duplicate of this question (but the 3rd dimension was discussed spatially there).
这篇关于使用R创建3D直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!