本文介绍了R点阵图和附言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制作一个点阵图的eps文件.创建了.eps文件,但该图似乎为空白(使用'gv').我一直在互联网上寻找解决方案,但是没有运气.

我的代码如下:

mydf <- data.frame(col1=c(1,1,2,2,3), col2=c(1,2,1,2,1), col3=rnorm(5))
library(lattice)
filename <- "myfile.eps"
postscript(file = filename,
           width = 10, height = 10,
           horizontal = FALSE, onefile = FALSE, paper = "a4")
 xyplot(col3 ~ col1 | col2, data = mydf)
 dev.off()

我试图用

mydf <- data.frame(col1=c(1,1,2,2,3), col2=c(1,2,1,2,1), col3=rnorm(5))
library(lattice)
filename <- "myfile.eps"
postscript(file = filename,
           width = 10, height = 10,
           horizontal = FALSE, onefile = FALSE, paper = "a4")
 xyplot(col3 ~ col1 | col2, data = mydf)
 dev.off()

替换postscript(...)表达式

  trellis.device("postscript", color = TRUE,
                 height = 10, width = 10,
                 horizontal = FALSE, onefile = FALSE, paper = "a4")

'.eps文件'是使用postscript(...)trellis.device(...)创建的,但是无论我做什么,用'gv'来看它似乎都是空白.

我非常感谢您的帮助或指导.西塞(Sisse)

解决方案

这是R FAQ 7.22: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not- work_003f

如上面的评论所述,

print(xyplot(co3 ~ col1 | col2, data = mydf)) 

应该工作

I have tried to make an eps-file of a lattice plot. The .eps-file is created, but the plot seem to be blank (using 'gv'). I have been searching the inter-net for a solution, but without luck.

My code is as follows:

mydf <- data.frame(col1=c(1,1,2,2,3), col2=c(1,2,1,2,1), col3=rnorm(5))
library(lattice)
filename <- "myfile.eps"
postscript(file = filename,
           width = 10, height = 10,
           horizontal = FALSE, onefile = FALSE, paper = "a4")
 xyplot(col3 ~ col1 | col2, data = mydf)
 dev.off()

I have tried to substitute the postscript(...) expression with

  trellis.device("postscript", color = TRUE,
                 height = 10, width = 10,
                 horizontal = FALSE, onefile = FALSE, paper = "a4")

The '.eps-file' is created using both postscript(...) and trellis.device(...), but seems blank looking at it with 'gv' no matter what I do.

I am greatful for any help or guidance.Sisse

解决方案

This is R FAQ 7.22: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

As indicated in comments above,

print(xyplot(co3 ~ col1 | col2, data = mydf)) 

should work

这篇关于R点阵图和附言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 22:03