2015-07-21 121 views
0

我使用iplot(更精确地说是GCR)为我的分析绘制多个交互式条形图和散点图。但是,对于每次执行,必须手动安排窗口(可能存在自动方式,我也不知道)。如何使用R在一个窗口中绘制多个交互式绘图?

所以,我想知道是否有办法将它们中的几个放在一个大窗口中。我知道有可能给窗口大小和位置。但是,他们将有多个令人恼火的窗口。

感谢

回答

0

我不知道的方式,两个地块的一个结合。然而,你可能会使用iplot.location()iplot.size,因为你已经提到:

library(iplots) 
iPlotsRestore <- function(setting) { 
    invisible(lapply(1:length(iplot.list()), function(x) { 
    iplot.location(x = setting[[x]]['x'], y = setting[[x]]['y'], plot = iplot.list()[[x]]) 
    iplot.size(width = setting[[x]]['width'], height = setting[[x]]['height'], plot = iplot.list()[[x]]) 
    })) 
} 

iplotsStore <- function() { 
    setting <- lapply(iplot.list(), function(x) iplot.location(plot = x)) 
    return(setting) 
} 


setting <- list(structure(c(542, 527, 432, 416), .Names = c("x", "y", "width", "height")), structure(c(10, 0, 432, 416), .Names = c("x", "y", "width", "height")), structure(c(885, 0, 873, 609), .Names = c("x", "y", "width", "height"))) 
invisible(lapply(iplot.list(), iplot.off)) # delete all plots 
ihist(iris$Sepal.Width) # recreate three demo plots 
ihist(iris$Petal.Length) 
ihist(iris$Sepal.Width) 
iPlotsRestore(setting) # recreate old window settings 

使用IplotsStore让目前所有地块,您可以保存到文件中的窗口参数列表。使用iPlotsRestore再次恢复窗口参数。

相关问题