你可以用scatterplot3d做到这一点(其中包括):
library(scatterplot3d)
#first draw the lines of the triangle
#using type="l" Since we are drawing a
#shape, include the first point twice to
#close the polygon
q <- scatterplot3d(c(50, 0, 0, 50),
c(0, 59, 0, 0), c(0, 0, 20, 0),
xlim=c(0, 60), ylim=c(0, 60), zlim=c(0, 60), type="l",
xlab="CPU Usage", ylab="Power Consumption", zlab="Bandwidth",
box=FALSE)
#now add the points. scatterplot3d creates a list,
#one element of which is a function that operates
#on the existing chart, q, adding points:
q$points3d(c(50, 0, 0), c(0, 59, 0), c(0, 0, 20))
当然,如果你需要做这些不止一个,你可以从你的数据拉点,而不是硬编码它们。我认为硬编码会使它更具可读性。
谢谢杰森!!! :)的工作方式正是我想象的! –