I seem to be having problems adding a title and axis labels in the rgl package. Here's a minimum working example:
> plot3d(x = c(1,2,3,1), y = c(2,3,1,4), z = c(2,3,4,5), type = 's', size =1)
> decorate3d(main = "My Plot")
I see neither labels (which should be set by default in decorate3d) nor My Plot
.
decorate3d
adds labels to an existing plot, so in your example
plot3d(x = c(1,2,3,1), y = c(2,3,1,4), z = c(2,3,4,5), type = 's', size =1)
creates a plot with xlab = 'c(1,2,3,1)', ylab = ' c(2,3,1,4)' etc
decorate3d
then adds the default values (x
,y
, z
) in addition to the original labels (as it is writing on the current plot).
If you want use decorate3d
to label the axes, it would be safer to set them as ''
in the original call to plot3d
eg
plot3d(x = c(1,2,3,1), y = c(2,3,1,4), z = c(2,3,4,5), type = 's', size =1,
xlab = '', ylab = '', zlab = '')
## then
decorate3d(main = "My Plot")
## will work as you wish.