0
是否有一種平臺無關的方式來排列屏幕輸出的格子圖?trellis.device的平臺無關版本(device =「windows」,...)
我的方法包括使用:
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))
似乎在Windows上工作 – mac