你可以用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))
當然,如果你需要做這些不止一個,你可以從你的數據拉點,而不是硬編碼它們。我認爲硬編碼會使它更具可讀性。
謝謝傑森!!! :)的工作方式正是我想象的! –