3

如何提高由 R 的 rgl 包(plot3d 和 movie3d 函数)生成的 gif 图像的分辨率 - 无论是外部还是通过 R ?

代码:

MyX<-rnorm(10,5,1)
MyY<-rnorm(10,5,1)
MyZ<-rnorm(10,5,1)
plot3d(MyX, MyY, MyZ, xlab="X", ylab="Y", zlab="Z", type="s", box=T, axes=F)
text3d(MyX, MyY, MyZ, text=c(1:10), cex=5, adj=1)
movie3d(spin3d(axis = c(0, 0, 1), rpm = 4), duration=15, movie="TestMovie",
                                                type="gif", dir=("~/Desktop"))

输出 :

输出 更新

在代码开头添加这一行解决了问题

r3dDefaults$windowRect <- c(0, 100, 1400, 1400) 
4

1 回答 1

4

我认为您对 gif 本身的分辨率无能为力。我认为您必须使图像更大作为替代方案,然后当您将其显示得更小时,它看起来会更好。这是未经测试的,因为最近的升级对我来说破坏了一两件事,但这确实在 2.15 下工作:

par3d(windowRect = c(0, 0, 500, 500)) # make the window large
par3d(zoom = 1.1) # larger values make the image smaller

# you can test your settings interactively at this point

M <- par3d("userMatrix") # save your settings to pass to the movie

movie3d(par3dinterp(userMatrix=list(M,
    rotate3d(M, pi, 1, 0, 0), 
    rotate3d(M, pi, 0, 1, 0) ) ), 
    duration = 5, fps = 50,
    movie = "MyMovie")

HTH。如果它不适合您,请检查使用的功能并调整设置。

于 2013-01-23T12:39:30.253 回答