有没有一种独立于平台的方法来排列屏幕输出的点阵图?
我的方法涉及到使用:
trellis.device(device="windows")
print(chart.hist, split = c(1,1,1,2), more = TRUE)
print(chart.cdf, split = c(1,2,1,2))在我的mac上,我需要trellis.device(device="x11",...),在我工作的windows机器上,我需要trellis.device(device="windows",...)
举个例子:
set.seed(1)
x <- rnorm(100, 0, 1)
discrete.cdf <- function(x, decreasing=FALSE){
x <- x[order(x,decreasing=FALSE)]
result <- data.frame(rank=1:length(x),x=x)
result$cdf <- result$rank/nrow(result)
return(result)
}
my.df <- discrete.cdf(x)
chart.hist <- histogram(~x, data=my.df,
xlab="")
chart.cdf <- xyplot(100*cdf~x, data=my.df, type="s",
ylab="Cumulative Percent of Total")
graphics.off()
trellis.device(device = "windows", width = 6, height = 6)
print(chart.hist, split = c(1,1,1,2), more = TRUE)
print(chart.cdf, split = c(1,2,1,2))发布于 2012-11-14 06:16:52
只需在trellis.device()函数中省略"device“选项即可。它将采用特定于平台的默认值(至少它在Linux上是这样工作的,"x11“是默认设备)。
https://stackoverflow.com/questions/13369323
复制相似问题