提高用R生成的png的分辨率

Improve the resolution of png generated with R

我通过 R.png 文件中的 IGRAPH package 创建了一些网络。我的目标是制作一个小视频来展示网络拓扑如何随时间变化。只是 .png 文件的分辨率真的很低。有没有一种方法可以生成相同的文件但分辨率更高?我的同事使用他的 PC 并使用相同的 R script 生成具有更高分辨率的网络。

这是我的代码:

wd<-getwd()
setwd(wd)
library(Matrix)
library(igraph)
library(slam)

plotname<-sprintf("g_communities_t%03d.png",t)
png(filename=plotname, height=640, width=640)
plot(community.infomap[[t]],g1[[t]],layout=layout.fruchterman.reingold,vertex.label=NA,edge.arrow.size=1,edge.curved=TRUE,vertex.size=2+sqrt(vertex.weight[[t]]))
dev.off()

感谢大家

使用pngres参数调整标称分辨率。请注意,为了保持文本大小等,相应地调整值 vor 高度和宽度是个好主意:

resfactor = 3
png(filename=plotname, res = 72*resfactor, height=640*resfactor, width=640*resfactor)

? png 为您提供更多详细信息(另见 ? dev.copy 将当前设备的图形内容复制到另一个)。