matplotlib-绘制具有相同大小的中心坐标的3D立方体
我有一个空间数据集,其中具有特定尺寸(20 m)的立方体中心坐标,以及用于颜色映射的变量。
我想在3D中绘制这些立方体;但是,我找不到方法。我试图通过计算多维数据集的角坐标来实现体素代码,但在某个点之后就卡住了。
数据集看起来像这样:
x y z variable
0 14630 21750 4690 0.087
1 14630 21770 4690 0.046
2 14630 21790 4690 0.045
3 14630 21930 5290 0.1657
4 14630 21950 5270 0.1144
我不确定是否应该使用ax.voxels或poly3dcollection。因此,如果您有任何提示,我将不胜感激。
I have a spatial dataset with the center coordinates of cubes with a specific size (20 m), and a variable for color mapping.
I want to plot these cubes in 3D; however, I couldn't find a way to do it. I've tried to implement a voxel code by calculating the corner coordinates of the cubes but got stuck after some point.
The dataset looks like this:
x y z variable
0 14630 21750 4690 0.087
1 14630 21770 4690 0.046
2 14630 21790 4690 0.045
3 14630 21930 5290 0.1657
4 14630 21950 5270 0.1144
I'm not sure if I should be using ax.voxels or Poly3DCollection. So, if you have any tips, I'd appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
iiuc,只需修改这个出色的答案 @david_sd在a
评论/I.SSTATIC.NET/4NAXV.PNG“ rel =” nofollow noreferrer“>
绘制3D立方体的代码:
IIUC, simply modifying this brilliant answer pointed by @David_sd in a comment, you can get the following figure:
Code to plot 3D cubes: