[R] 3D-scatterplots - high quality rendering?

J.delasHeras at ed.ac.uk J.delasHeras at ed.ac.uk
Thu Oct 21 19:23:11 CEST 2010


Quoting Duncan Murdoch <murdoch.duncan at gmail.com>:

> J.delasHeras at ed.ac.uk wrote:
>> I have just started using the package 'rgl' to explore my data as a  
>>  3D scatterplot.
>>
>> It's a great tool. But I would like to be able to save some graph    
>> views and it appears the only format available is 'png' and it   
>> doesn't look that nice. It is excellent to work with on screen and   
>>  explore/play, but when it comes to producing a good quality  
>> graphic   I'm a bit disappointed.
>>
>> So the questions I have are:
>>
>> 1) is there a way to render the graph in the RGL device as a high    
>> quality graphic?
>>
>
> You can use rgl.postscript for various other formats, but you may find
> the bitmap output is better.  In particular, shading is not always done
> correctly.
>
> Duncan Murdoch


Hi Duncan,

thanks for that.
Stupidly I hadn't realised only part of the manual had printed so I  
was missing a lot of interesting options, not only this one but others  
to animate views.

The type of plots I'm producing are similar to these:

library(rgl)
m<-matrix(rnorm(900),ncol=3)
plot3d(m,col=rainbow(6),type="s",size=0.8)

I tried rgl.postscript to save to pdf, as it's become my default  
format when I want smooth plots using standard R graphics X11()
It looks smoother, but I get some "artifacts" in that the edges and  
colouring of a number of spheres are rough, or incompletely coloured  
(imagine a small scratch on a photograph)

using 'rgl.snapshot' to output a bitmap (png) with small spheres it  
doesn't look that great. The default squares look fine 'though.

I guess I'll just play with these limitations. I was just wondering if  
there was a simple way to get significantly better results.
But I'm not complaining! :) the 'rgl' package is pretty impressive!

Thank you.

Jose de las Heras






-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the R-help mailing list