[R] lattice change font of one specific axis label in each panel

David Winsemius dwinsemius at comcast.net
Thu Mar 27 22:34:23 CET 2014


On Mar 27, 2014, at 8:11 AM, el_alisio wrote:

> Hi Kevin,
> 
> thanks for the advice! The code is now reproducible. Sorry!

No, it is not, since you can only read it on Nabble, yecch. There is some sort of weird format stuff that Nabble does that prevents code from appearing on Rhelp copies.


> Actually I wanted to print only one x-label ("All Postdoctorates") in bold
> face, not all of them. This would be easily achieved, if "All
> Postdoctorates" appeared always in the same row of each panel, but this is
> not the case here.
> 

p1 <- dotplot(prop.table(postdoc, margin = 1), groups = FALSE,
              xlab = "Proportion", layout = c(1, 5), aspect = 0.6,
              scales = list(y = list(relation = "free", rot = 0) ), 
              prepanel = function(x, y) {
                list(ylim = levels(reorder(y, x)))
              },
              panel = function(x, y, ...) {
                panel.dotplot(x, reorder(y, x), ...)
                },
        yscale.components = function(...){
              temp <- yscale.components.default(...)
               loc <- temp$left$labels$at
               print( temp$left$labels$labels <-  
                      sapply( temp$left$labels$labels, 
                               function(x) if(grepl("All", x)){
                                    as.expression(bquote( bold(.(x)))) 
                                          }else{ 
                                    as.expression(bquote(.(x)))} ))
              temp }
             )
print(p1)

> 
> --
> View this message in context: http://r.789695.n4.nabble.com/lattice-change-font-of-one-specific-axis-label-in-each-panel-tp4687638p4687663.html
> Sent from the R help mailing list archive at Nabble.com.

Nabble si not an archive. It throws stuff away. It is not the Rhelp mailing list either.
> 
> ______________________________________________
> R-help at 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.

David Winsemius
Alameda, CA, USA




More information about the R-help mailing list