[Xts-commits] r722 - pkg/xtsExtra/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 16 22:02:43 CEST 2012
Author: weylandt
Date: 2012-08-16 22:02:43 +0200 (Thu, 16 Aug 2012)
New Revision: 722
Modified:
pkg/xtsExtra/R/plot.R
Log:
Allow user to specify layout heights and args, not documented
Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R 2012-08-16 05:03:32 UTC (rev 721)
+++ pkg/xtsExtra/R/plot.R 2012-08-16 20:02:43 UTC (rev 722)
@@ -218,6 +218,11 @@
layout.screens <- matrix(layout.screens, ncol = nc)
}
+ if(is.list(layout.screens)) {
+ layout.args <- layout.screens[-1]
+ layout.screens <- layout.screens[[1]]
+ }
+
layout.screens <- as.matrix(layout.screens)
have_x_axis <- logical(length(levels(screens)))
@@ -302,10 +307,17 @@
# to layout -- currently undocumented behavior
# do.call("layout", as.list(layout.screens))
# Currently I add a little bit extra height to those screens with x-axes
- if(length(layout.screens) > 1L)
- layout(layout.screens, heights = 1 + 0.05*NROW(unique(layout.screens)) *
- sapply(1:NROW(layout.screens), # More dirty hacking.... still not perfect
- function(j) any(have_x_axis[layout.screens[j,]])))
+ if(length(layout.screens) > 1L){
+ if(!exists("layout.args")) {
+ layout(layout.screens, heights = 1 + 0.05*NROW(unique(layout.screens)) *
+ apply(layout.screens, 1,function(j) any(have_x_axis[j])))
+ # More dirty hacking.... still not perfect
+ } else {
+ do.call(layout, c(list(layout.screens), layout.args))
+ }
+ }
+
+
return(list(layout.screens = layout.screens, screens = screens, have_x_axis = have_x_axis,
More information about the Xts-commits
mailing list