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

J.delasHeras at ed.ac.uk J.delasHeras at ed.ac.uk
Fri Oct 22 12:43:39 CEST 2010


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

> On 21/10/2010 1:23 PM, J.delasHeras at ed.ac.uk wrote:
>> 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.
>
> The way I usually save output is to use rgl.snapshot after increasing
> the size of the window as large as possible.  At 1000 x 1000 pixels I
> find the output okay.
>
> How large is possible will depend on your hardware and OpenGL driver.
> Usually you can't make it any bigger than your physical monitor, and
> you can't always make it that big.
>
> Duncan Murdoch

It's working pretty nicely for me, enlarging the window like you say.
I have an interesting looking set of data that I was able to explore  
very easily using different thresholds/colour codes and I just made a  
pretty cool figure. Surprisingly easy once I had the whole manual  
printed in front of me and with your comments.

Again, many thanks for your help and your work in the 'rgl' package!

best,

Jose

-- 
Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6507095
Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK


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



More information about the R-help mailing list