Setting size of the rgl device

Jen Bohold picture Jen Bohold · Aug 5, 2013 · Viewed 8.1k times · Source

I have a problem with the fullscreen / non-fullscreen of my rgl device.

Currently I use R 3.00

I plot a persp3d plot (library rgl) into my device, it opens in a quite small window:

The R code:

persp3d(x, y, z, theta=50, phi=25, expand=0.75, col=red,
        ticktype="detailed", xlab="", ylab="", zlab="",axes=FALSE)
axes3d(c('x--','z'))

axis3d(edge='y+-',at =c(1,500,1000,1500,2000,2320),
labels =rownames(fd)[c(1,500,1000,1500,2000,2320)])

Which looks like this:

sc

I now rotated it and saved the single png files to my drive. The problem is, that the png files are too small? I want to put them into one paper using LaTex and the \animategraphics command, but it is to pixely (not sharp).

If I click on the fullscreen icon in the rgl device, so that the R plot is larger, this does help and everything works. The problem is, that there is too much white space around it. With this white space above, below, left and right to it I cannot include it in LaTex, because it does not fit because of its big size (width, height). I have 200 png files, so manually removing the white space with paint is not a nice work.

The small pictures look like this:

sc11

The following happens, if you zoom in (this is, what LaTex does, when I put it into my paper, it increases the picture, screenshot is from my LaTex file. Same picture, a slightly different angle, but the problem stays the same):

sc22

You see that it looks pixely (not good). Also you can already see the problem with the large files with too much white space: The small picture with some white space above already destroys my title.

So how could I solve this problem? How can I tell R to use the fullscreen plots but without so much white space around it? When I click on fullscreen and save those pictures everything is fine, except the white space around it.

Here is the png file with too much white space around it (in this screenshot there is no white space below, but when I use the correct zoom it is there):

sc2

One further note: This is the R code I use to save the png- files:

M <- par3d("userMatrix")
movie3d( spin3d(rpm=3), duration=20,dir="C:/test/movie", clean=FALSE )
play3d( spin3d(rpm=3), duration=20)

Answer

Annie picture Annie · Aug 2, 2016

Use par3d(windowRect = c(20, 30, 800, 800))