我希望在R中绘制我的模型输出。
这是一个三角网格,格式如下:
x1 y1 z1 x2 y2 z2 x3 y3 z3 value
每一行代表一个三角形,我想用value
作为标度来绘制这些三角形。
mymesh <- structure(c(0.91, 0.45, 13.93, 14.26, 14.15, 14.36, 14.36, 14.61,
14.58, 14.87, 14.8, 15.13, 15.02, 15.39, 15.24, 15.65, 15.46,
15.9, 15.69, 16.16, 0, 0.79, 12.45, 12.64, 12.34, 12.46, 12.24,
12.38, 12.13, 12.3, 12.03, 12.22, 11.92, 12.13, 11.81, 12.04,
11.69, 11.94, 11.57, 11.84, 0, 0, 208.71, 208.69, 210.7, 210.68,
212.68, 212.66, 214.67, 214.65, 216.66, 216.63, 218.64, 218.61,
220.62, 220.59, 222.61, 222.57, 224.59, 224.56, 0.45, 1.5, 14.15,
14.15, 14.36, 14.36, 14.58, 14.58, 14.8, 14.8, 15.02, 15.02,
15.24, 15.24, 15.46, 15.46, 15.69, 15.69, 15.92, 15.92, 0.79,
0, 12.34, 12.34, 12.24, 12.24, 12.13, 12.13, 12.03, 12.03, 11.92,
11.92, 11.81, 11.81, 11.69, 11.69, 11.57, 11.57, 11.45, 11.45,
0, 131.83, 210.7, 210.7, 212.68, 212.68, 214.67, 214.67, 216.66,
216.66, 218.64, 218.64, 220.62, 220.62, 222.61, 222.61, 224.59,
224.59, 226.58, 226.58, 1.5, 0.75, 14.26, 14.36, 14.36, 14.61,
14.61, 14.87, 14.87, 15.13, 15.13, 15.39, 15.39, 15.65, 15.65,
15.9, 15.9, 16.16, 16.16, 16.42, 0, 1.3, 12.64, 12.46, 12.46,
12.38, 12.38, 12.3, 12.3, 12.22, 12.22, 12.13, 12.13, 12.04,
12.04, 11.94, 11.94, 11.84, 11.84, 11.74, 131.83, 131.83, 208.69,
210.68, 210.68, 212.66, 212.66, 214.65, 214.65, 216.63, 216.63,
218.61, 218.61, 220.59, 220.59, 222.57, 222.57, 224.56, 224.56,
226.54, 375.12, 399.8, 297.84, 497.63, 368.17, 1113.19, 979,
781.41, 1202.21, 1113.94, 1293.77, 1391.94, 1364.52, 1151.37,
1690.98, 913.63, 0, 0, 0, 0), .Dim = c(20L, 10L), .Dimnames = list(
NULL, c("x1", "y1", "z1", "x2", "y2", "z2", "x3", "y3", "z3",
"value")))
我已经查看了rgl、plot3D和misc3d包。然而,这些似乎处理的是点,而不是三角形(例如,rgl.points、rgl.linestrips和rgl.triangles函数都将x、y和z作为输入,而不是三角形)。
如何使用R来绘制并着色此数据集中的三角形?
rgl::triangles3d
吗?它的帮助页面(?triangles3d
)包括了一个不错的例子。在我看来,如果这正是你想要的,那么你唯一需要做的就是将你的数据重新塑造成适当格式的三列矩阵。 - Josh O'Brien