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

2014-03-27 Thread el_alisio
Dear R-users,

I would like to change the font of one specific axis label to bold face in
each panel. Taking one of Deepayan's plots as an example, how do I change
All Postdoctorates to bold face?

dotplot(prop.table(postdoc, margin = 1), groups = FALSE, index.cond =
function(x, y) median(x), 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), ...) })

Thank you very much for your help in advance, I truly appreciate it!

Jannes



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

__
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.


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

2014-03-27 Thread Kevin Wright
A reproducible example would help us help you, but you probably need to use
the font argument, something along the lines of this...

xlab = list(some axis label,cex=1.5,font=4) # 2=bold, 4 = bold italic

Kevin



On Thu, Mar 27, 2014 at 3:57 AM, el_alisio malnama...@gmx.de wrote:

 Dear R-users,

 I would like to change the font of one specific axis label to bold face in
 each panel. Taking one of Deepayan's plots as an example, how do I change
 All Postdoctorates to bold face?

 dotplot(prop.table(postdoc, margin = 1), groups = FALSE, index.cond =
 function(x, y) median(x), 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), ...) })

 Thank you very much for your help in advance, I truly appreciate it!

 Jannes



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

 __
 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.




-- 
Kevin Wright

[[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.


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

2014-03-27 Thread el_alisio
Hi Kevin,

thanks for the advice! The code is now reproducible. Sorry!

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.

Cheers, 

Jannes



--
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.

__
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.


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

2014-03-27 Thread David Winsemius

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@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

__
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.


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

2014-03-27 Thread David Winsemius

On Mar 27, 2014, at 2:34 PM, David Winsemius wrote:

 
 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( removed debugging print line
   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)


I suppose taking out the debugging code might be wise, see above. I had 
previously emailed Deepayan to inquire why `bquote` expressions would not 
succeed in lattice without applying a further `as.expression` and he said he 
that what was returned from `bquote` wasn't really an R expression, but rather 
an unevaluated call. I thought I should be able to get this to work but if 
failed to apply the blding but tit did print the labels:

..
 function(x) if(grepl(All, x)){
+substitute( bold(x), list(x=x)) 
+  }else{ 
+substitute( x, list(x=x))} 
...
-- 

David Winsemius
Alameda, CA, USA

__
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.