SCM

SCM Repository

[latticeextra] Diff of /pkg/R/horizonplot.R
ViewVC logotype

Diff of /pkg/R/horizonplot.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 95, Wed Jan 20 06:18:33 2010 UTC revision 96, Wed Jan 20 13:48:48 2010 UTC
# Line 1  Line 1 
1    ##
2    ## Copyright (c) 2010 Felix Andrews <felix@nfrac.org>
3    ## GPL version 2 or newer
4    
5    
6  horizonplot <- function(x, data, ...)  horizonplot <- function(x, data, ...)
# Line 8  Line 11 
11               panel = panel.horizonplot,               panel = panel.horizonplot,
12               prepanel = prepanel.horizonplot,               prepanel = prepanel.horizonplot,
13               strip = FALSE, groups = NULL,               strip = FALSE, groups = NULL,
14               layout = c(1, Inf),               layout = c(1, NA),
15               default.scales = list(y = list(relation = "sliced")))               default.scales =
16                   list(y = list(relation = "sliced", draw = FALSE)))
17  {  {
18      stopifnot(is.null(data))      stopifnot(is.null(data))
19      if (!is.null(groups))      if (!is.null(groups))
# Line 29  Line 33 
33  {  {
34      regions <- trellis.par.get("regions")      regions <- trellis.par.get("regions")
35      origin <- current.panel.limits()$y[1]      origin <- current.panel.limits()$y[1]
     #if (is.function(origin))  
     #    origin <- origin(y)  
     #scale <- max(abs(range(y, finite = TRUE) - origin)) / 3  
36      scale <- diff(current.panel.limits()$y)      scale <- diff(current.panel.limits()$y)
37      ## ordered for drawing, from least extreme to most extreme      ## ordered for drawing, from least extreme to most extreme
38      sections <- c(-1, 0, -2, 1, -3, 2, -4, 3) ## these are the lower bounds      sections <- c(0, -1, 1, -2, 2, -3, 3, -4) ## these are the lower bounds
     #ycut <- cut(y, breaks = c(-Inf, breaks, Inf))  
39      ii <- quantile(seq_along(col.regions),      ii <- quantile(seq_along(col.regions),
40                     (sections - min(sections)) / (length(sections)-1),                     (sections - min(sections)) / (length(sections)-1),
41                     type = 1)                     type = 1)
     #col <- col.regions[1 + (length(col.regions)-1) * 0:5/5]  
42      col <- col.regions[ii]      col <- col.regions[ii]
43      for (i in seq_along(sections)) {      for (i in seq_along(sections)) {
44          section <- sections[i]          section <- sections[i]

Legend:
Removed from v.95  
changed lines
  Added in v.96

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge