2017-03-11 94 views
1

(我使用RGL)。我想在下面的移動軸標籤:R/rgl - 如何移動3D軸標籤?

plot3d(1,2,3, xlab="x", ylab="y", zlab="z", xlim=c(-4,4), ylim=c(-4,4), zlim=c(-4,4)) 
abclines3d(x = matrix(0, ncol=3), a = diag(3), col="black", lwd=3) 

於所示的位置:

Red arrows showing that I want the labels next to the positive x,y,and z axes

基本上,我想要標籤位於正x,y和z軸的「末端」。我該怎麼做呢?

回答

2

你可以嘗試這樣的事:

plot3d(1,2,3, xlab="", ylab="", zlab="", xlim=c(-4,4), ylim=c(-4,4), zlim=c(-4,4)) 
abclines3d(x = matrix(0, ncol=3), a = diag(3), col="black", lwd=3) 
text3d(matrix(c(3,0.2,0.2,4,-6,4,0.1,0.1,3),ncol=3),texts=c('y', 'x', 'z')) 

enter image description here

+0

嗯,這是接近!除了當我旋轉時,「y」和「z」不在它們各自的軸的末端。你能稍微調整一下這個定位嗎? – anon

+0

@anon我認爲最好的選擇將嘗試不同的文本位置值,以適應您的確切要求。 –

+1

你的意思是我必須弄清楚自己? =) – anon