Put a fixed title in an interactive 3D plot using rgl package, R -
i trying add fixed title interactive 3d plot using rgl package r, far haven't been able it. have 1 main title , subtitle under main title.
here sample code,
library(rgl) data<-read.table(text=" x y z 1 147.0883 -18.69122 -13.90000 2 147.0894 -18.69455 -10.97250 3 147.0883 -18.69122 -17.45000 4 147.0883 -18.69122 -15.44000 5 147.0883 -18.69122 -13.45000 6 147.0909 -18.69922 -12.25000 7 147.0883 -18.69122 -17.30000 8 147.0883 -18.69122 -16.40000 9 147.0883 -18.69122 -14.30000 10 147.0883 -18.69122 -18.50000 11 147.0883 -18.69122 -15.67606 12 147.0883 -18.69122 -17.25780 13 147.0883 -18.69122 -3.64000 14 147.1164 -18.68133 -22.13000 15 147.0883 -18.69122 -18.54778 16 147.0883 -18.69122 -15.50000 17 147.1185 -18.68691 -14.55500 18 147.0883 -18.69122 -18.12500 19 147.0901 -18.69670 -14.39767",header=t) data a<-as.matrix(data) # call plug-in bandwidth estimator h.pi<-hpi(a,binned=true)*3 ## matrix of x,y,z points # calculate kernel densities fhat<-kde(a,h=h.pi) # produce 3d plot open3d() title<-"individual 1 (male)" # main title title2<-"site a" # subtitle plot(fhat,cont=c(50,95),colors=c("green","red"),drawpoints=true, xlab="",ylab="", zlab="",size=1.5,ptcol="black", axes=f,box=t,aspect=c(1,1,0.5),zlim=c(-40,0)) axes3d(c("x--","y--","z-+"),cex=0.8) mtext3d("longitude",edge="x--",line=3,las=2,cex=1.1) mtext3d("latitude",edge="y--",line=3,las=2,cex=1.1) mtext3d("depth (m)",edge="z-+",line=3,las=2,cex=1.1) title3d(main=title,sub=title2,line=4)
i haven't found way of having fixed title (and subtitle) when export plot 3d movie, main title not rotating plot...
movie3d(spin3d(axis=c(0,0,1), rpm=4),dir="~/dropbox/r/sample plots", duration=15, fps=10, movie="plot 1")
if have good/easy way of putting main title in fixed location (and possibly adding secondary title under) great. in advance,
this cannot done in rgl @ present.
Comments
Post a Comment