I am trying to add a fixed title to an interactive 3d plot using the rgl package from R, but so far I haven\'t been able to do it. I also would like to have one main title a
Putting a title in a RGL plot is now possible, thanks to an update dating from last year.
The idea is to use the new function bgplot3d which outputs to the background of the RGL window, as if it was a normal plot.
For example:
# A minimal plot3d example
library(rgl)
a = matrix(runif(3000), ncol=3)
plot3d(a, col = rainbow(100)[cut(a[,1], breaks = seq(0,1,le=101), include.lowest = T)])
bgplot3d({
plot.new()
title(main = 'This is the main title', line = 3)
mtext(side = 1, 'This is a subtitle', line = 4)
# use here any other way you fancy to write your title
})
Which gives:
There is one pretty important caveat though, stated as a note in the help page for bgplot3d:
Because the background plots are drawn as bitmaps, they do not resize very gracefully. It's best to size your window first, then draw the background at that size.