导出rgl.snapshot和rgl.postscript失败 [英] Exporting rgl.snapshot and rgl.postscript fails

查看:161
本文介绍了导出rgl.snapshot和rgl.postscript失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用rgl包进行某些数据表示. 这是我的命令

I am currently using the rgl package for some data representation. Here's my command

mypath("directory")
png(file=mypath, res=600, width=10.5, height= 10.5,units="in",bg = "transparent")
require(rgl)
set.seed(1)
df <- data.frame(replicate(4,sample(1:200,1000,rep=TRUE)))
colnames(df) <- c("var1","var2","var3","var4")
plot3d(x=df$var1, y=df$var2, z=df$var3, col=as.numeric(df$var4), size=0.5, type='s',xlab="var1",ylab="var2",zlab="var3")
rgl.snapshot(mypath)

上面的命令可以工作并产生一个很小的图像,我无法将其放大或将其分辨率提高到600.

The command above works and produces a tiny image, which I wasn't able to make bigger, or increase its resolution (to 600).

我还尝试使用以下方法导出pdf文件:

I have also tried to export a pdf using:

rgl.postscript(mypath, fmt="pdf") 

但是当我执行命令时,R进入无响应"状态.

but when I execute the command R goes into a "not responding" state.

有人可以告诉我如何正确导出文件吗?我希望使用分辨率为600 dpi的PNG.

Can somebody please show me how to properly export the file? I would prefer the have the PNG with the resolution 600 dpi.

干杯

推荐答案

一种解决方案是使用open3d()设置窗口的大小:

A solution can be to set the size of the window using open3d() :

require(rgl)
set.seed(1)

df <- data.frame(replicate(4,sample(1:200,1000,rep=TRUE)))
colnames(df) <- c("var1","var2","var3","var4")
open3d(windowRect=c(100,100,700,700))
plot3d(x=df$var1, y=df$var2, z=df$var3, col=as.numeric(df$var4), size=0.5, type='s',xlab="var1",ylab="var2",zlab="var3")
rgl.snapshot(<path to png file>)

这篇关于导出rgl.snapshot和rgl.postscript失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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