Thanks to Dunkan, Rasmus and Bert. Will keep the very useful tips. Best! On Sun, Aug 16, 2020 at 9:13 PM Rasmus Liland <jral at posteo.no> 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: > > plot(y, main=bquote(paste( > "data" ~~ widehat(aleph) > %notin% .(s)^.(s)))) > > V > > r >[[alternative HTML version deleted]]
David K Stevens
2020-Aug-17 17:26 UTC
[R] [EXT] Re: Plot math symbol with string and number
John - one more approach plot(y,main=parse(text=paste0('data ~~ sigma == ',s))) Good luck David Stevens On 8/17/2020 8:23 AM, John Smith wrote:> Thanks to Dunkan, Rasmus and Bert. Will keep the very useful tips. Best! > > On Sun, Aug 16, 2020 at 9:13 PM Rasmus Liland <jral at posteo.no> 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: >> >> plot(y, main=bquote(paste( >> "data" ~~ widehat(aleph) >> %notin% .(s)^.(s)))) >> >> V >> >> r >> > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > CAUTION: This email originated from outside of USU. If this appears to be a USU employee, beware of impersonators. Do not click links, reply, download images, or open attachments unless you verify the sender?s identity and know the content is safe. >-- David K Stevens, P.E., Ph.D. Professor, Environmental Engineering Civil and Environmental Engineering Utah Water Research Laboratory 8200 Old Main Hill Logan, UT 84322-8200 435 797 3229 - voice 435 797 1363 - fax david.stevens at usu.edu
Thanks David for a quite interesting suggestion: Indeed I didn't know paste0! Best! On Mon, Aug 17, 2020 at 12:26 PM David K Stevens <david.stevens at usu.edu> wrote:> John - one more approach > > plot(y,main=parse(text=paste0('data ~~ sigma == ',s))) > > Good luck > > David Stevens > > On 8/17/2020 8:23 AM, John Smith wrote: > > Thanks to Dunkan, Rasmus and Bert. Will keep the very useful tips. Best! > > > > On Sun, Aug 16, 2020 at 9:13 PM Rasmus Liland <jral at posteo.no> 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: > >> > >> plot(y, main=bquote(paste( > >> "data" ~~ widehat(aleph) > >> %notin% .(s)^.(s)))) > >> > >> V > >> > >> r > >> > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > CAUTION: This email originated from outside of USU. If this appears to > be a USU employee, beware of impersonators. Do not click links, reply, > download images, or open attachments unless you verify the sender?s > identity and know the content is safe. > > > -- > David K Stevens, P.E., Ph.D. > Professor, Environmental Engineering > Civil and Environmental Engineering > Utah Water Research Laboratory > 8200 Old Main Hill > Logan, UT 84322-8200 > 435 797 3229 - voice > 435 797 1363 - fax > david.stevens at usu.edu > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]