设置 rgl 设备的大小 [英] Setting size of the rgl device

查看:21
本文介绍了设置 rgl 设备的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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:

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:

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):

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):

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)

解决方案

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

这篇关于设置 rgl 设备的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆