簡體   English   中英

如何使用R在一個窗口中繪制多個交互式圖?

[英]How to plot multiple interactive plots in one window using R?

我使用iplot (更准確地說是GCR)繪制多個交互式條形圖和散點圖進行分析。 但是,對於每次執行,都必須手動安排窗口(我可能不知道,也可能存在自動方式)。

因此,我想知道是否有一種方法可以將其中的幾個放置在一個大窗口中。 我知道可以給出窗口的大小和位置。 但是,它們將具有多個令人討厭的窗口。

謝謝

我不知道將兩個圖合並成一個圖的方法。 但是,您可能已經在使用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再次還原窗口參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM