[R] embedding expression into title in R plot
wdunlap at tibco.com
Mon Jan 11 20:08:14 CET 2016
I tend to use bquote, as in
x_label <- bquote(bold(species) ~ (italic(N1)))
plot(1:10,main=bquote("This is the expression for" ~ .(x_label) * "!"))
On Mon, Jan 11, 2016 at 7:59 AM, Evan Cooch <evan.cooch at gmail.com> wrote:
> Suppose I've specified that the xlab for a plot is
> In other words, I want the axis label to be bold, italic 'species (N1)'
> Now, I want the title for the plot to be have this label embedded in the
> Say, 'This is the plot for Species (N1)'.
> For a variety of reasons, I've set this up so that the xlab is a global
> parameter (basically, because the labels are set in a function which
> when called, generates various plots):
> x_label <<- expression(bold(species~(italic(N1))))
> So, in the title, I've tried
> title(main=paste("This is the plot for ",x_label,"nullcline", sep=" "));
> but what this does is generate something like
> 'This is the plot for bold(species~(italic(N1)))'
> In other words, it pastes the text of the expression into the title, but
> not what the expression 'evaluates' to.
> Is there any way around this?
> Thanks in advance...
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help