如何打开eps文件?

时间:2014-10-16 02:37:33

标签: r figure eps

我想从R结果中打开eps文件。下面是我生成eps文件的代码。

有没有办法在R中打开文件?或者我该如何打开它?

请告诉我。

如果(ITER %% n保存== 0){

# Save MCMC output
blocknow=iter/nsave
save(THETA,file=paste("MCMC/G",Gr,"C",Chain,"/Theta",blocknow,".Rdata",sep=""))
save(PHI,GAMMA,DELTA,SIGMAETA,SIGMAEPS,MUPHI,MUGAMMA,MUDELTA,SIGMAPHI,SIGMAGAMMA,SIGMADELTA,file=paste("MCMC/G",Gr,"C",Chain,"/Pars", blocknow,".Rdata",sep=""))

# Plot MCMC output
postscript(file=paste("FIGS/Monitor_SigmaEtaEps.eps"));    par(mfrow=c(2,2));plot.ts(SIGMAETA[1,1,1,]);plot.ts(SIGMAETA[2,2,1,]);plot.ts(SIGMAEPS[1,1,1,]);plot.ts(SIGMAEPS[2,2,1,]);dev.off()
postscript(file=paste("FIGS/Monitor_MuPhi.eps"));          par(mfcol=c(4,5));for(par in 1:20){plot.ts(MUPHI[par,1,],ylim=c(-1,1))};dev.off()
#postscript(file=paste("FIGS/Monitor_MuGammaDelta.eps"));   par(mfcol=c(2,2));for(par in 1:2){plot.ts(MUGAMMA[par,1,]);plot.ts(MUDELTA[par,1,])};dev.off()
postscript(file=paste("FIGS/Monitor_SigmaPhi.eps"));       par(mfcol=c(4,5));for(par in 1:20){plot.ts(SIGMAPHI[par,par,1,])};dev.off()
#postscript(file=paste("FIGS/Monitor_SigmaGammaDelta.eps"));par(mfcol=c(2,2));for(par in 1:2){plot.ts(SIGMAGAMMA[par,par,1,]);plot.ts(SIGMADELTA[par,par,1,],ylim=c(0,4))};dev.off()

}

1 个答案:

答案 0 :(得分:1)

eps文件只是一种postscript,它们是文本文件。任何可以从文件中读取的函数都应该能够处理它,例如readLines():

postscript("cm_test.eps", width = 4.0, height = 3.0,
           horizontal = FALSE, onefile = FALSE, paper = "special",
           family = "ComputerModern", encoding = "TeXtext.enc")
plot(1,1); dev.off()

> readLines("cm_test.eps", n=10)
 [1] "%!PS-Adobe-3.0 EPSF-3.0"               "%%DocumentNeededResources: font CMR10"
 [3] "%%+ font CMBX10"                       "%%+ font CMSL10"                      
 [5] "%%+ font CMBXSL10"                     "%%+ font CMSY10 CMBSY10 CMMI10"       
 [7] "%%Title: R Graphics Output"            "%%Creator: R Software"                
 [9] "%%Pages: (atend)"                      "%%BoundingBox: 0 0 288 216"