R中的三轴图
我有一个关于在R中生成三维图形的问题。假设,我有一个csv格式的文件中的以下数据R中的三轴图,r,R,我有一个关于在R中生成三维图形的问题。假设,我有一个csv格式的文件中的以下数据 CPU_Usage Power_Consumption(Watt) Bandwidth 50 59 20MB 现在我想在xyz轴上表示,其中x轴表示cpu,y表示功率,z表示带宽。然后,我希望这些值在三轴图上连接在一起(通过一条线),形成一个三角形。数据中只有一行。如果有人能帮我,我将不胜感激 您可以使用scatterplot3d(除其他外)完成此操作:
CPU_Usage Power_Consumption(Watt) Bandwidth
50 59 20MB
现在我想在xyz轴上表示,其中x轴表示cpu,y表示功率,z表示带宽。然后,我希望这些值在三轴图上连接在一起(通过一条线),形成一个三角形。数据中只有一行。如果有人能帮我,我将不胜感激 您可以使用scatterplot3d(除其他外)完成此操作:
库(scatterplot3d)
#首先画三角形的线
#使用type=“l”,因为我们正在绘制
#形状,包括第一个点两次以
#闭合多边形
Q
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))