R - 个性化3dplot

时间:2016-01-25 13:26:04

标签: r plot 3d grid

我想通过添加一个完整的网格并插入灰色背景来个性化我的plot3d。另外,我想将标签放在缩放轴的中间。我无法使用grid()函数添加网格。这是我可重复的例子:

# Helix
x1 <- c(1,1) 
y1 <- c(1,1)
z1 <- c(1,2)

# Monopulse
x2 <- c(1,3) 
y2 <- c(1,2)
z2 <- c(1,1)

# Smart Shelf
x3 <- c(1,5) 
y3 <- c(1,5)
z3 <- c(1,5)

# Phased system
x4 <- c(1,2) 
y4 <- c(1,2)
z4 <- c(1,4)

rgl.bg(color = "gray")
grid <- expand.grid(x=x, y=y)
plot3d(x1, y1, z1, cex=1.5, size=4, type="l",col="red",lty=2,    xlab="Cost",ylab="Time",zlab="Space")
plot3d(x2, y2, z2, cex=1.5, size=4, type="l",col="blue",add=TRUE)
plot3d(x3, y3, z3, cex=1.5, size=4, type="l",col="green",add=TRUE)
plot3d(x4, y4, z4, cex=1.5, size=4, type="l",col="orange",add=TRUE)
aspect3d(1,1,1)
legend3d("topright", legend = c('Single beam', 'Narrow beam', 'Multibeam','Phased beam'), pch = 16, col = c("red","blue","green","orange"), cex=1, inset=c(0.02))
snapshot3d(filename = '3dplot.png', fmt = 'png')

0 个答案:

没有答案