2015-07-21 217 views
1

我正在使用scatterplot3d來生成幾個圖,我想保持在每個圖(我試圖顯示隨着時間的推移變化,所以這是至關重要的)的尺度一致。我當前的代碼如下(絕不是優雅的,因爲我是一個初學者!):scatterplot3d - 改變軸範圍

library(scatterplot3d) 
file<-read.csv("DAY2.csv") 
axis1<-file$axis1 
axis2<-file$axis2 
axis3<-file$axis3 
s3d <- scatterplot3d(axis1, axis2, axis3) 
colors <- c("#9900FF", "#E69F00", "#339900", "#0000FF") 
colors <- colors[as.numeric(file$treatment)] 
s3d <- scatterplot3d(file[,1:3], pch = 16, color=colors, xlab = 
"Axis 1", ylab = "Axis 2", zlab = "Axis 3") 
legend(s3d$xyz.convert(0.4, 0.4, -0.1), col= c("#9900FF", "#E69F00", 
"#339900", "#0000FF"), bg="white", lty=c(1,1), lwd=2, yjust=0,  
legend = c("high perf", "low perf"), cex = 0.7) 

是否可以指定軸範圍,以保持小區間的這些一致的?我已經檢查過小插曲,但是這裏沒有任何信息。

由於提前,

回答

-1

請使用xlimylimzlim,情節的xyz限制(最小值,最大值)。

0

您可以使用XLIM,ylim和zlim如何論點sccaterplot3d功能,例如:

library(scatterplot3d) 
x <- c(1, 2, 3) 
y <- c(2, 2, 2) 
z <- c(6, 7, 8) 
max_x <- max(x) 
min_x <- min(x) 
max_y <- max(y) 
min_y <- min(y) 
max_z <- max(z) 
min_z <- min(z) 
s3d <- scatterplot3d(x,y,z, pch=6, angle=45, color="red", 
     xlim=c(min_x,max_x), 
     ylim=c(min_y,max_y), 
     zlim=c(min_z,max_z)) 

如果修改XLIM,ylim或zlim將改變軸。