On Fri, Jul 17, 2009 at 3:39 AM, Alex Brown<fisht...@compsoc.man.ac.uk> wrote: > > Sure thing, an example.: > > ggplot > (data.frame(name=letters[1:3],value=c(1,4,9),type=c("fun","fun","not > fun")),aes(x=name,y=value,fill=type,label=paste("value is ",value))) + > geom_bar() + coord_flip() + geom_text(hjust=0) > > I'd like the option to allow the text " value is 9 " to spill out of the > plot region into the unused border partially occupied by the legend.
Ah ok. Unfortunately, there's currently no way for ggplot2 to figure out how to increase the range of the x axis to avoid clipping text within the plot. This means you have to extend the y axis yourself, e.g. with + ylim(0, 12) > Also, is it possible to move each label right by one em (1 nominal font > height)? I think you can do that in grid graphics, but I can't see how to > do it here. I suppose I could always add an em space to the start of the > text, but I was thinking of something like x = value + unit(1,"char") You can't do it with ems, but you can do it with data units: df <- data.frame( name = letters[1:3], value = c(1,4,9), type = c("fun","fun","not fun") ) ggplot(df, aes(name, value, fill = type)) + geom_bar() + geom_text(aes(label=paste("value is ",value), y = value + 0.5), hjust = 0) coord_flip() + Hadley PS. You might also want to join the ggplot2 mailing list: http://groups.google.com/group/ggplot2 -- http://had.co.nz/ ______________________________________________ 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.