Marius Hofert
2011-Jun-02 22:50 UTC
[R] lattice + plotmath: how to get a variable in bold face?
Dear all, How can I get a bold "1000" in the title? I would like to use a variable (as opposed to putting in "1000" directly). library(lattice) N <- 1000 xyplot(0~0, xlab.top=list(label=as.expression(bquote(bold("foo" ~ .(N) ~ "bar"))), font=2, cex=1.2)) ## => "font=2" is ignored (of course) Cheers, Marius
Peter Ehlers
2011-Jun-02 23:30 UTC
[R] lattice + plotmath: how to get a variable in bold face?
On 2011-06-02 15:50, Marius Hofert wrote:> Dear all, > > How can I get a bold "1000" in the title? I would like to use a variable (as opposed to putting in "1000" directly). > > library(lattice) > N<- 1000 > xyplot(0~0, xlab.top=list(label=as.expression(bquote(bold("foo" ~ .(N) ~ "bar"))), font=2, cex=1.2)) > ## => "font=2" is ignored (of course)You could add N <- as.character(N) before your call to xyplot. Peter Ehlers> > Cheers, > > Marius > ______________________________________________ > 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.
Marius Hofert
2011-Jun-03 06:03 UTC
[R] lattice + plotmath: how to get a variable in bold face?
Dear Dennis, Dear Peter, thank you very much, as.character() worked perfectly. Nice solution :-) All the best, Marius On 2011-06-03, at 03:42 , Dennis Murphy wrote:> If you're trying to figure out a way to embolden a Greek letter in > plotmath, it ain't gonna happen. From the plotmath help page: > > "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." > > That's why Peter suggested using as.character(N), where N is a number. > That trick obviously won't work for symbols, as noted above. > > Dennis > > On Thu, Jun 2, 2011 at 3:50 PM, Marius Hofert <m_hofert at web.de> wrote: >> Dear all, >> >> How can I get a bold "1000" in the title? I would like to use a variable (as opposed to putting in "1000" directly). >> >> library(lattice) >> N <- 1000 >> xyplot(0~0, xlab.top=list(label=as.expression(bquote(bold("foo" ~ .(N) ~ "bar"))), font=2, cex=1.2)) >> ## => "font=2" is ignored (of course) >> >> Cheers, >> >> Marius >> ______________________________________________ >> 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. >>
Possibly Parallel Threads
- plotmath: paste string and expression [from a vector of expressions]
- Quiz: Who finds the nicest form of X_1^\prime?
- splom, plotmath: how to add three lines of information with alignment?
- How to use expression(italic()) in a "vectorized" way (within a function)?
- Expressions from boxplot() passed to bxp()