Plot math symbol with string and number
"Plotmath seems to be the right way to do it. " Not sure I agree with that. Paul Murrell put together plotmath around 2000 prior to the widescale development and adoption of the unicode standard (corrections/modifications welcome!). So at the time, there really was no other way to handle this for most OS'es. With UTF8 now being generally supported for Unicode, plotmath constructions may not be needed for simple symbol labeling, as here. Of course for more complex symbolism (fractions, integrals, ...) it will be. ?plotmath talks about this and has links to further issues and options, btw. In other words, unicode may indeed be better than my suggestion of plotmath here. I would welcome comments from others who are more knowledgeable about this than I am. Bert
On Mon, Aug 17, 2020 at 2:14 PM <cpolwart at chemo.org.uk> wrote:
On 2020-08-17 03:13, Rasmus Liland wrote:
On Sun, Aug 16, 2020 at 3:18 PM Bert wrote:
| On Sun, Aug 16, 2020, 14:53 John wrote:
| |
| | I would like to make plots with
| | titles for different data sets and
| | different parameters. The first
| | title doesn't show sigma as a math
| | symbol, while the second one
| | doesn't contain the s value as a
| | numeric value
| |
| | s <- 1
| | y <- rnorm(100)
| | plot(y, main=paste("data", "sigma=", s))
| | plot(y, main=expression(paste("data", sigma,"=", s)))
|
| ?plotmath
Dear John, read ?plotmath, it is good, I
was not aware of its existence; then
backquote s like so:
Plotmath seems to be the right way to do it. But without reading
plotmath I'd have gone with this:
plot(y, main=paste("data", "\u03C3=", s))