[R] expression() and font.lab ?

Aparna Radhakrishnan ar532 at cam.ac.uk
Fri Apr 27 21:52:44 CEST 2012


Hi...sorry that my question seemed incomplete.

The plotting code :
par(cex.axis=0.8,las=1,font.lab=2,font.axis=2,family="sans",mgp=c(2,1,0),mar=c(3, 3, 4, 2)+0.1)
plot(A$pos,-log(A$GPVI_frequentist_add_Batch_expected_pvalue,10),col=A$R2class,pch=A$pch,xlim=c(161160087,161214038),ylim=c(0,7),xlab="Genomic position",ylab=expression(-log[10]~(P-value)))

I am using a MacBook Pro and I have the R 2.15.0 . I have used only the base-graphics and not loaded any other libraries.

Hope that completes the question.

Please also find the plot attached here. Note the y-axis label is not in bold face or in "sans" font.

Regards,
Aparna.


On 27 Apr 2012, at 19:36, David Winsemius wrote:

> 
> On Apr 27, 2012, at 11:22 AM, aparna15 wrote:
> 
>> Hi..
>> 
>> I managed to use expression() for superscripting and subscripting values in
>> my axis labels.
> 
> What's missing here is your plotting code and your machine and R installation details. You may want to review the Posting Guide for what is requested. Plotting issues are more machine dependent than other aspects. Since the ?plotmath page does have details that include:
> 
> "The fonts used are taken from the current font family, and so can be set by par(family=) in base graphics, and gpar(fontfamily=) in package grid.
> 
> Note that bold, italic and bolditalic do not apply to symbols, and hence not to the Greek symbols such as mu which are displayed in the symbol font. They also do not apply to numeric constants."
> 
> ... my speculation is that you may not be using base graphics or you may have excessive expectations regarding how symbols are displayed. You can sometimes get around that last limitation by using character values where you want numeric values in bold or italic. Again, we need full details. Put together a reproducible example and repost.
> 
> -- 
> David
> 
> 
>> However, I notice that the font and style that I had passed
>> through par() are ignored.
>> 
>> I used :
>> par(font.lab=2, font=2, family="sans")
>> 
>> but when I employ expression() for my xlab, the styling given above is
>> completely ignored.
>> 
>> I would greatly appreciate it if someone knew of a method of maintaing the
>> style while superscripting or subscripting in an axis label.
>> 
>> Regards,
>> Aparna.
>> 
>> 
>> --
>> View this message in context: http://r.789695.n4.nabble.com/expression-and-font-lab-tp4592991p4592991.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> 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, MD
> West Hartford, CT
> 



More information about the R-help mailing list