[Xts-commits] r701 - in pkg/xtsExtra: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 7 02:40:33 CEST 2012


Author: weylandt
Date: 2012-08-07 02:40:33 +0200 (Tue, 07 Aug 2012)
New Revision: 701

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Ghastly bug fix for problem with yax alignment with labels and fancy panelling

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-08-06 23:57:01 UTC (rev 700)
+++ pkg/xtsExtra/R/plot.R	2012-08-07 00:40:33 UTC (rev 701)
@@ -103,6 +103,7 @@
     screens <- do_layout(x, screens = screens, layout.screens = layout.screens, 
                          yax.loc = yax.loc, nc = nc, nr = nr, ylim = ylim)
     
+    layout.screens <- screens[["layout.screens"]]
     have_x_axis <- screens[["have_x_axis"]]
     have_y_axis <- screens[["have_y_axis"]]
     ylab.axis <- screens[["ylab.axis"]]
@@ -127,12 +128,13 @@
       } else {
         log.panel <- ""
       }
-
+      
       # Note that do_add.grid also sets up axes and what not
       do_add.grid(x.plot, major.ticks, major.format, minor.ticks, 
             auto.grid = auto.grid, ylab = ylab.panel, log = log.panel, 
             have_x_axis = have_x_axis[i], have_y_axis = have_y_axis[i],
-            ylab.axis = ylab.axis[i], events = events, blocks = blocks,
+            ylab.axis = ylab.axis[as.vector(layout.screens)][layout.screens == i][1], 
+            events = events, blocks = blocks,
             yax.loc = yax.loc, ylim = get.elm.recycle(ylim, i))
       
       
@@ -244,7 +246,9 @@
     if(NCOL(layout.screens) != 2L) stop("yax.loc not consistent with layout -- too many columns.")
     # If labels are set to out we need them for outer panels only
     # If labels are set to in we need them for inner panels only
+    
     ylab.axis <- layout.screens 
+    
     ylab.axis[,1] <- if(yax.loc == "out") "left" else "right"
     ylab.axis[,2] <- if(yax.loc == "out") "right" else "left"
     have_y_axis[] <- TRUE # Axes for all if TRUE
@@ -287,7 +291,7 @@
                             function(j) any(have_x_axis[layout.screens[j,]])))
   
   
-  return(list(screens = screens, have_x_axis = have_x_axis, 
+  return(list(layout.screens = layout.screens, screens = screens, have_x_axis = have_x_axis, 
               have_y_axis = have_y_axis, ylab.axis = ylab.axis, ylim = ylim))
 }
 

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-08-06 23:57:01 UTC (rev 700)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-08-07 00:40:33 UTC (rev 701)
@@ -131,9 +131,7 @@
 
 # Use of color gradient
 cr <- colorRampPalette(c("#00FF00","#FF0000"))
-plot(sample_xts[,1],sample_xts[,2], xy.labels = FALSE, xy.lines = TRUE, col = cr(NROW(sample_xts)))
-
-plot(sample_xts[,1], sample_xts[,2], xy.labels = FALSE, xy.lines = TRUE, type = "l")
+plot(sample_xts[,1],sample_xts[,2], xy.labels = FALSE, xy.lines = TRUE, col = cr(NROW(sample_xts)), type = "l")
 }
 % Add one or more standard keywords, see file 'KEYWORDS' in the
 % R documentation directory.



More information about the Xts-commits mailing list