Dear R-helpers,

(1) How do I add a 'top' label symmetric with the 'bottom' label' in:

axis.td <-
      function(side, ...)
  {
      ylim <- current.panel.limits()$ylim
      switch(side,
             bottom = {
                 panel.axis(side = side, outside = TRUE, rot = 0,
                            at = 1:3, labels = c(2.0, 3.5, 5.0))
             },
             top = {
                 panel.axis(side = side, outside = TRUE, rot = 45,
                            at = 1:3, labels = c(0.143, 0.250, 0.357))
             },
             axis.default(side = side, ...))
  }

xyplot(1:3 ~ 1:3, type = 'b', axis = axis.td, xlab = 'bottom', ylab =  
'left', aspect = 'xy')

(2) Is there a simpler way to create the two axes?

(3) A bit more complex:

df <- data.frame(x = rep(1:3, 3), y = 1:9, z = factor(rep(1:3, each =  
3)))
xyplot(y ~ x | z, df, axis = axis.td, xlab = 'bottom', ylab = 'left',  
layout = c(3, 1), aspect = 'xy', type = 'b')

Here I would like to have a different pair of top and bottom axes for  
each panel (i.e., different labels at 1:3), and a different top and  
bottom label.
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to