5

I'm trying to generate a 3d scatterplot using rgl. It looks great on my screen, but whenever I export it as a PDF (or any other postscript format) it completely ignores any size specifications I use.

(I'm running RGui v.2.15.1 and rgl v.0.92.892 on a Macbook under Mountain Lion.)

For example:

library(rgl) 
set.seed(1982) 
points3d(runif(5),runif(5),runif(5), size=20)
# points look huge
rgl.postscript('testplot.pdf', fmt='pdf')
# points look tiny

Does anyone have an idea for a way to get this to work? The resolution of the images I get using rgl.snapshot don't look so good, and I would really like to get a vector image for this plot.

Also, I followed this thread and I got text to resize just fine, but not points. So I thought one way to work around this would be to plot my points as text using a circle as my character, but I couldn't get rgl to accept symbols or expressions either...

Community
  • 1
  • 1

1 Answers1

4

Confirmed on Windows, look like some paper size scaling problem. You might try

spheres3d(runif(5),runif(5),runif(5),radius=0.1)

as a workaround if you can live with real 3d.

Dieter Menne
  • 10,076
  • 44
  • 67
  • Thanks! I tested and it worked (I'll just add to your answer in that I got rid of the 3d "feel" of spheres by using `lit=F` in the `spheres()` command. This way they look very similar to dot points) – Rafael Maia Oct 19 '12 at 14:32
  • 2
    That works, but be cautious: spheres need much more resources, and with a few thousands of them, interactivity may become sluggish. – Dieter Menne Oct 21 '12 at 08:57