Re: [R] Partial italic in graph titles when looping

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Tue, 12 Apr 2011 00:02:46 +0200

On Apr 11, 2011, at 6:28 PM, Josh B wrote:

> Follow-up question:
>
> I want to make the gene name bold and italic, AND make the "p"
> number just bold. But here's the catch: now I want the "p" number to
> appear as a superscript!
>

I am no longer clear (if I ever was) what the "p number might be, but here is my guess:

main = bquote(italic(.(x[i,1]))*bolditalic(" p")^.(as.character(x[i, 2])))

For more than a guess, post a worked example, please.

-- 
David.


> For instance: TFL1^687 (the carrot is to indicate that I actually
> want the "p" number as a superscript).
>
> Thanks very much in advance!
>
> Sincerely,
> Josh Banta
>
> From: David Winsemius <dwinsemius_at_comcast.net>
> To: Josh B <joshb41_at_yahoo.com>
> Sent: Sat, February 19, 2011 10:24:03 PM
> Subject: Re: [R] Partial italic in graph titles when looping
>
>
> On Feb 19, 2011, at 8:52 PM, Josh B wrote:
>
> > Follow-up question: how would I make the gene name italic AND
> bold, and how would I make the " p" and the number just bold?
>
> Could also work inside teh .() function
>
> for (i in 1:nrow(x)){
> plot(z <- sort(rnorm(47)), type = "s", main = "")
> points(z, cex = .5, col = "dark red")
> title(main = bquote(italic(.(x[i,1]))*bold(" p")*bold(.
> (as.character(x[i,2])))))
> }
> >
> > From: David Winsemius <dwinsemius_at_comcast.net>
> > To: Josh B <joshb41_at_yahoo.com>
> > Cc: R Help <r-help_at_r-project.org>
> > Sent: Sat, February 19, 2011 8:33:33 PM
> > Subject: Re: [R]Partial italic in graph titles when looping
> >
> >
> > On Feb 19, 2011, at 7:41 PM, Josh B wrote:
> >
> > > Dear all,
> > >
> > > I have a rather complicated problem. I am trying to loop through
> making graphs,
> > > so that the graph-making process is fully automated. For each
> graph, I'd like to
> > > make sure the corresponding title is formatted properly. The
> titles will be a
> > > combination of a gene name and numerical position within the
> gene. The gene name
> > > should be italic-bold, whereas the gene position should be just
> bold.
> > >
> > > Consider the following:
> > >
> > > x <- read.table(textConnection("gene position
> > > FLC 3312
> > > TFL1 687
> > > GA1 1127"), header = TRUE, as.is = TRUE)
> > > closeAllConnections()
> > >
> > > Now this, below, is essentially how I am automating the graph-
> making (imagine
> > > these graphs contain some sort of real data):
> > >
> > > par(mfrow = c(3,1))
> > > for (i in 1:nrow(x)){
> > > plot(z <- sort(rnorm(47)), type = "s", main = "")
> > > points(z, cex = .5, col = "dark red")
> > > title(main = paste(x[i,1], " p", x[i,2], sep = ""))
> > > }
> > >
> > Or perhaps (with a shuffling of the parens):
> > for (i in 1:nrow(x)){
> > plot(z <- sort(rnorm(47)), type = "s", main = "")
> > points(z, cex = .5, col = "dark red")
> > title(main = bquote(italic(.(x[i,1]))*" p"*.(x[i,2])))
> > }
> >
> > > The graphs produced by this method are almost perfect, except
> that the gene
> > > names are not italicized (they SHOULD be).
> > >
> > >
> > > So, once again, the big question is: how would I italicize the
> gene names but
> > > NOT the gene positions, when looping through to make these
> graphs and graph
> > > titles? If I WASN'T looping to make my graph titles, I could
> write:
> > >
> > > title(main = expression(paste(bolditalic("FLC"), bold("p3312"),
> sep = " ")))
> > >
> > > ...but I can't do that, because I'm looping (or can I?)
> > >
> > > Thanks in advance for your help!
> > >
> > > -----------------------------------
> > > Josh Banta, Ph.D
> > > Center for Genomics and Systems Biology
> > > New York University
> > > 100 Washington Square East
> > > New York, NY 10003
> > > Tel: (212) 998-8465
> > > http://plantevolutionaryecology.org
> > >
> > >
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > 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
> >
> >
> >
>
> David Winsemius, MD
> West Hartford, CT
>
David Winsemius, MD Heritage Laboratories West Hartford, CT ______________________________________________ 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.
Received on Mon 11 Apr 2011 - 22:06:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 12 Apr 2011 - 00:00:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive