[R] x axis position and ggplot2
    Duncan Mackay 
    dulcalma at bigpond.com
       
    Thu Dec 11 02:57:31 CET 2014
    
    
  
Hi 
I do not know ggplot2 well enough to give any advice but as Geff has mention lattice see
http://tolstoy.newcastle.edu.au/R/e2/help/07/05/17666.html
library(grid)
myXlabGrob <-
function(...){ ## ...is lab1, lab2, etc
   # you can add arguments to textGrob for more control  in the next line
   labs <- lapply(list(...), textGrob)
   nlabs <- length(labs)
   lab.heights <-
   lapply(labs, function(lab) unit(1, "grobheight", data = list(lab)))
   lab.layout <-
   grid.layout(ncol = nlabs, nrow = 1,
                   heights = do.call(max, lab.heights),
                   widths = unit(1, "null"),
                   respect = TRUE)
   lab.gf <- frameGrob(layout = lab.layout)
   for (i in seq_len(nlabs)){
     lab.gf <- placeGrob(lab.gf, labs[[i]], row = 1, col = i)
   }
   lab.gf
}
xyplot(1:10 ~ 1:10,
        scales = list(x = list(alternating = 2)), # puts scale on the top rather than the bottom
        xlab = "", # removes label at bottom
        xlab.top = myXlabGrob('B')
        )
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jouanin Celine
Sent: Thursday, 11 December 2014 02:44
To: r-help at r-project.org
Subject: [R] x axis position and ggplot2
Hi all,
Is it possible to change the position of the x axis to have it at the top of the plot when we use the ggplot function ?Thanks for your help,Céline
	[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
    
    
More information about the R-help
mailing list