[Xts-commits] r692 - in pkg/xtsExtra: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 24 19:01:01 CEST 2012


Author: weylandt
Date: 2012-07-24 19:01:01 +0200 (Tue, 24 Jul 2012)
New Revision: 692

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/TODO
Log:
More robust fix for r691

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-07-24 16:10:49 UTC (rev 691)
+++ pkg/xtsExtra/R/plot.R	2012-07-24 17:01:01 UTC (rev 692)
@@ -355,10 +355,13 @@
 }
 
 do_add.shading <- function(blocks, y){
-  for(j in seq_along(blocks[["start.time"]])){
-    rect(as.POSIXct(get.elm.recycle(blocks[["start.time"]], j)), min(0, -3*min(y), 3*min(y)), ## Dirty hack!
-         as.POSIXct(get.elm.recycle(blocks[["end.time"]], j)), max(0, 3*max(y), -3*max(y)), 
-         col = if(!is.null(blocks[["col"]])) get.elm.recycle(blocks[["col"]],j) else "lightblue1",
+  yrng <- c(0, -3*max(y), 3*min(y), 3*max(y), -3*min(y)) # Dirty Hack
+  
+  for(j in seq_along(blocks[["start.time"]])){    
+    rect(as.POSIXct(get.elm.recycle(blocks[["start.time"]], j)), max(yrng),
+         as.POSIXct(get.elm.recycle(blocks[["end.time"]], j)), min(yrng),
+         col = if(!is.null(blocks[["col"]])) 
+           get.elm.recycle(blocks[["col"]],j) else "lightblue1",
          border = NA)
   }
 }

Modified: pkg/xtsExtra/TODO
===================================================================
--- pkg/xtsExtra/TODO	2012-07-24 16:10:49 UTC (rev 691)
+++ pkg/xtsExtra/TODO	2012-07-24 17:01:01 UTC (rev 692)
@@ -14,7 +14,7 @@
          xlim to allow plotting trading hours only
          ylab.loc = "above" -- put ylabels where titles normally go
     -- Bugs: 
-        
+         labels sometimes overlap (see Jul24 example from KR where Russian and LTCM cross)
     -- Not Sure: 
         x <- as.xts(sample_matrix); plot(cbind(x, x[,1]), layout = matrix(1:6, ncol = 2)) -- is this a bug? ggplot2 is ok with it
         
@@ -24,4 +24,5 @@
   -- barplot.xts
     -- Features:
     -- Bugs:
+        space argument for unstacked plots 
     -- Long term:



More information about the Xts-commits mailing list