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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 19 21:17:02 CEST 2012


Author: weylandt
Date: 2012-08-19 21:17:02 +0200 (Sun, 19 Aug 2012)
New Revision: 725

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Waste a little less space when axis labels are one line

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-08-19 06:18:17 UTC (rev 724)
+++ pkg/xtsExtra/R/plot.R	2012-08-19 19:17:02 UTC (rev 725)
@@ -377,8 +377,8 @@
   if(axes) {
     if(have_x_axis){
       if(minor.ticks) axis(1L, at = xy$x, labels = FALSE, col = par("col.axis"))
-      axis(1L, at = xy$x[ep], labels = names(ep), lwd = 1L, 
-           mgp = c(3, 2, 0), col = par("col.axis"))  
+      axis(1L, at = xy$x[ep], labels = names(ep), lwd = 1L, col = par("col.axis"),
+           mgp = if(any(grepl("\n",names(ep), fixed = TRUE))) c(3, 2, 0) else c(3,1,0))  
       # Not sure why I have to force col.axis but it seems I do
     }
     if(have_y_axis){

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-08-19 06:18:17 UTC (rev 724)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-08-19 19:17:02 UTC (rev 725)
@@ -134,7 +134,6 @@
 
 plot(sample_xts[,c(1:4, 3:4)], layout = matrix(c(1,1,1,1,2,2,3,4,5,6), ncol = 2, byrow = TRUE), yax.loc = "top")
 
-
 # Type = "p" allows for transparent handling of the pch= argument
 x <- xts(1:5, Sys.Date() + 1:5)
 plot(x, type = "p")
@@ -155,9 +154,9 @@
 # Using the events argument
 plot(sample_xts[,1], events = list(time = c("2007-03-15", "2007-05-01"), label = "bad days"))
 
-plot(sample_xts[,1], events = list(time = c("2007-03-15","2007-05-01"), label = "bad days"), blocks = list(start.time = c("2007-03-05", "2007-04-15"), end.time = c("2007-03-20","2007-05-30"), col = c("lightblue", "lightgreen")))
+plot(sample_xts[,1], events = list(time = c("2007-03-15","2007-05-01"), label = "bad days"), blocks = list(start.time = c("2007-03-05", "2007-04-15"), end.time = c("2007-03-20","2007-05-30"), col = c("lightblue1", "lightgreen")))
 
-plot(sample_xts, layout.screens = matrix(c(1,1,2,3,4,4), ncol = 2, byrow = TRUE), events = list(time = c("2007-03-15","2007-05-01"), label = "bad days"), blocks = list(start.time = c("2007-03-05", "2007-04-15"), end.time = c("2007-03-20","2007-05-30"), col = c("lightblue", "lightgreen")))
+plot(sample_xts, layout.screens = matrix(c(1,1,2,3,4,4), ncol = 2, byrow = TRUE), events = list(time = c("2007-03-15","2007-05-01"), label = "bad days"), blocks = list(start.time = c("2007-03-05", "2007-04-15"), end.time = c("2007-03-20","2007-05-30"), col = c("lightblue1", "lightgreen")))
 
 # Makes a scatterplot if we pass two series
 plot(sample_xts[,1],sample_xts[,2])



More information about the Xts-commits mailing list