Pengyao
Pengyao

Reputation: 827

How to draw only axis in R for 3d plot?

Basically I only want to draw the x, y, z axis with empty plot, but with x, y, z of my own labels on it. Is it possible to do it in R? I know how to draw it in 2d plot.

Upvotes: 1

Views: 1702

Answers (1)

Ali
Ali

Reputation: 9830

Here is your answer:

library(scatterplot3d)
scatterplot3d(0,0,0, pch="", xlab="X", ylab="Y",zlab="Z", 
              xlim=c(0,1), ylim=c(0,1), zlim=c(0,1))

The position of Y label seems a bit strange. This is a limitation of this package. So you may set ylab="" and then manually put the label to your desired place by text(x, y, "Y")

enter image description here

Upvotes: 1

Related Questions