[R] [EXT] Re: Plot math symbol with string and number

David K Stevens d@v|d@@teven@ @end|ng |rom u@u@edu
Mon Aug 17 19:26:02 CEST 2020


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 using 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 using 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 using usu.edu



More information about the R-help mailing list