Setting the size of an rgl device

I have a problem with fullscreen / not fullscreen mode of my rgl device.

I am currently using R 3.00

I captured on my device a graph of persp3d (rgl library) that opens in a rather small window:

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

Now I rotated it and saved single png files to my disk. Is the problem that the png files are too small? I want to put them on the same paper using LaTex and the \animategraphics , but it should be pixel (not sharp).

If I click on the full-screen icon in the rgl device, so the R graph is bigger, it helps and everything works. The problem is that there is too much free space around it. With this white space above, below, left, and right to it, I can not include it in LaTex, because it does not fit because of its large size (width, height). I have 200 png files, so manually removing a space with paint is not a good job.

Small pictures look as follows:

sc11

If you zoom in (this is what LaTex does when I put it in my paper, it leads to a larger image, a screenshot from my LaTex file. The same image, a little different, but the problem remains the same):

sc22

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

So how can I solve this problem? How can I tell R to use full-screen scenes, but not much white space around it? When I click on full screen mode and save these photos, everything is fine except for the spaces around it.

Here is a png file with too many spaces around it (there is no space below in this screenshot, but when I use the correct scaling it is):

sc2

One more note: this is the R code that I use to save png files:

 M <- par3d("userMatrix") movie3d( spin3d(rpm=3), duration=20,dir="C:/test/movie", clean=FALSE ) play3d( spin3d(rpm=3), duration=20) 
+7
r save plot latex rgl
source share
3 answers

You can check the status of the RGL device with par3d. Space is controlled by the values ​​of windowRect. When the display size increases, these values ​​automatically increase;

 > par3d("windowRect") [1] 100 100 356 378 > par3d("windowRect") # made the window have roughly 4 times the area [1] 137 0 744 544 

You can also specify what the angles of windowRect will be.

 ?par3d 

This should give you control that avoids the "space problems" and the header overlap.

If you want to make the object larger in the viewport, the rgl.viewpoint function can scale. Reducing the number of objects does more.

 rgl.viewpoint( zoom = .5 ) 
+3
source share

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

+3
source share

It was enough to install r3dDefaults:

 r3dDefaults$windowRect <- c(0,50, 800, 800) plot3d(mdatapc, col=kmeanspc.cluster, size = 10) 
0
source share

All Articles