[R] rgl.postscript() failure when saving a scene
ppiras at uniroma3.it
ppiras at uniroma3.it
Fri Dec 9 15:49:45 CET 2011
Dear all,
I write to the community to know if other people
expierenced the same problem. I want to save a rgl
scene where I plotted a 3d cloud of spheres whose
radius is set proportional to a given variable and
coloured by another group variable and with 95%
ellipsoids for distribution of any group.
I had no problem at all for coding but I had two
problem when saving the scene (in any format) using
rgl.postscript()
1- using plot3d(), if the points are set to sphere
whose radius is proportional to a given variable the
rgl.postscript() causes R crash
2- using simple points the scene is saved but the
transaprencies of ellipsoids are lost.
HERE below I copy a script with simulated data. I use
R.2.14 but even with R2.12 I got the same problems
Thankyou in advance for your help.
datii<-data.frame(cbind(rnorm(30,1,1),rnorm(30,2,1),rnorm(30,3,1),abs(rnorm(30,4,1)),c(rep(1:2,15))))
axis3D(axis.col="black",axis.scale=max(datii[,1:3]),axis.len=0.03)
arrows3D(c(0,0,0),c(-max(datii[,1:3]),0,0),length=0.03)
arrows3D(c(0,0,0),c(0,-max(datii[,1:3]),0),length=0.03)
arrows3D(c(0,0,0),c(0,0,-max(datii[,1:3])),length=0.03)
######### with this command, i.e. "type="p", I cannot
set the points dimension proportional to a given
variable #######
plot3d(datii[,1:3],box=F,col=datii[,5],type="p",cex=datii[,4]/10,add=T,bbox=F)
##### MAJOR PROBLEM: here (type="s") I can do that
but...when I go to save the scene using
rgl.postscript() R crasches .###########
plot3d(datii[,1:3],box=F,col=datii[,5],type="s",radius=datii[,4]/10,add=T,bbox=F)
#### MINOR PROBLEM: these are the 95% ellipses for any
group; when saving using rgl.postscript() IN ANY
FORMAT the transaparencies are lost ####
plot3d(ellipse3d(cov(subset(datii[,1:3],datii[,5]==1)),centre=c(mean(subset(datii[,1],datii[,5]==1)),mean(subset(datii[,2],datii[,5]==1)),mean(subset(datii[,3],datii[,5]==1)))),col=1,alpha=0.3,add=T)
plot3d(ellipse3d(cov(subset(datii[,1:3],datii[,5]==2)),centre=c(mean(subset(datii[,1],datii[,5]==2)),mean(subset(datii[,2],datii[,5]==2)),mean(subset(datii[,3],datii[,5]==2)))),col=2,alpha=0.3,add=T)
rgl.postscript(file="test.pdf",fmt="pdf") #### THIS
COMMAND CAUSES R CRASCH WHEN THE RGL SECENE IS LOADED
WITH POINTS SET AS "SPHERES" ### AND THEIR RADIUS
IS PROPORTIONAL TO A GIVEN VARIABLE.
--
Paolo Piras
Center for Evolutionary Ecology
and
Dipartimento di Scienze Geologiche, Università Roma Tre
Largo San Leonardo Murialdo, 1, 00146 Roma
Tel: +390657338000
email: ppiras at uniroma3.it
More information about the R-help
mailing list