Additional polymath query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Additional polymath query

Fisher Dennis
R 3.2
OS X

Colleagues

Yesterday, I asked:
        I have a polymath label for a graphic:
                bquote(AUC[0-infinity]~(ng/ml~x~hours))
        I would like the “x” to be replaced with a bullet.  

David Winsemius provided an answer:
        %.%
(which is also known as “cdot”)

That works but the dot is small — I would prefer something bolder.  
Further searching led to the following:
        plot(1, xlab="\u25CF")

Now I can’t figure out how to incorporate
        \u25CF
into the original command (to replace the “x” below):
        bquote(AUC[0-infinity]~(ng/ml~x~hours))

As much as I enjoy plotmath, it remains a bit of a mystery to me.  Any advice would be appreciated.

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Additional polymath query

Bert Gunter-2
Quote the unicode -- it's just a way to write a text character:

bquote(AUC[0-infinity]~(ng/ml~"\u25CF"~hours)


Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Jan 2, 2016 at 8:52 AM, Fisher Dennis <[hidden email]> wrote:

> R 3.2
> OS X
>
> Colleagues
>
> Yesterday, I asked:
>         I have a polymath label for a graphic:
>                 bquote(AUC[0-infinity]~(ng/ml~x~hours))
>         I would like the “x” to be replaced with a bullet.
>
> David Winsemius provided an answer:
>         %.%
> (which is also known as “cdot”)
>
> That works but the dot is small — I would prefer something bolder.
> Further searching led to the following:
>         plot(1, xlab="\u25CF")
>
> Now I can’t figure out how to incorporate
>         \u25CF
> into the original command (to replace the “x” below):
>         bquote(AUC[0-infinity]~(ng/ml~x~hours))
>
> As much as I enjoy plotmath, it remains a bit of a mystery to me.  Any advice would be appreciated.
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Additional polymath query

Duncan Murdoch-2
In reply to this post by Fisher Dennis
On 02/01/2016 11:52 AM, Fisher Dennis wrote:

> R 3.2
> OS X
>
> Colleagues
>
> Yesterday, I asked:
> I have a polymath label for a graphic:
> bquote(AUC[0-infinity]~(ng/ml~x~hours))
> I would like the “x” to be replaced with a bullet.
>
> David Winsemius provided an answer:
> %.%
> (which is also known as “cdot”)
>
> That works but the dot is small — I would prefer something bolder.
> Further searching led to the following:
> plot(1, xlab="\u25CF")
>
> Now I can’t figure out how to incorporate
> \u25CF
> into the original command (to replace the “x” below):
> bquote(AUC[0-infinity]~(ng/ml~x~hours))
>
> As much as I enjoy plotmath, it remains a bit of a mystery to me.  Any advice would be appreciated.

Just replace x with "\u25CF" (including the quotes).  You do need to be
a little careful here:  not all graphics devices support all Unicode
characters.  That one works on my OSX system running in RStudio, but you
didn't say what particular output format you wanted, so you'll need to
check it yourself.

Duncan Murdoch

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Additional polymath query

David Winsemius
In reply to this post by Fisher Dennis

> On Jan 2, 2016, at 8:52 AM, Fisher Dennis <[hidden email]> wrote:
>
> R 3.2
> OS X
>
> Colleagues
>
> Yesterday, I asked:
> I have a polymath label for a graphic:
> bquote(AUC[0-infinity]~(ng/ml~x~hours))
> I would like the “x” to be replaced with a bullet.  
>
> David Winsemius provided an answer:
> %.%
> (which is also known as “cdot”)
>
> That works but the dot is small — I would prefer something bolder.  
> Further searching led to the following:
> plot(1, xlab="\u25CF")
>
> Now I can’t figure out how to incorporate
> \u25CF
> into the original command (to replace the “x” below):
> bquote(AUC[0-infinity]~(ng/ml~x~hours))
>
> As much as I enjoy plotmath, it remains a bit of a mystery to me.  Any advice would be appreciated.
The `?plotmath` help page also refers you to the help page on `?points`. I have on several occasions used the last example on that page to create an annotated table of glyphs associated with the Symbol font "characters" in the higher ranges of values:

pdf(); TestChars <- function(sign = 1, font = 1, ...)
{
   MB <- l10n_info()$MBCS
   r <- if(font == 5) { sign <- 1; c(32:126, 160:254)
       } else if(MB) 32:126 else 32:255
   if (sign == -1) r <- c(32:126, 160:255)
   par(pty = "s")
   plot(c(-1,16), c(-1,16), type = "n", xlab = "", ylab = "",
        xaxs = "i", yaxs = "i",
        main = paste( "Mac Symbol: points example", sprintf("sign = %d, font = %d", sign, font)))
   grid(17, 17, lty = 1) ; mtext(paste("MBCS:", MB))
   for(i in r) {
         try(points(i%%16, i%/%16, pch = sign*i, font = font,...))
         try(text(i%%16 -.3, i%/%16-.3, labels = i,cex=.6)) }
}

TestChars(font = 5); dev.off()




Looks to me that the 183 glyph might be to your liking. `points` has a 'cex' parameter that could be used to embolden it further if needed.

--
David.

>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
> ______________________________________________
> [hidden email] 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.
David Winsemius
Alameda, CA, USA


______________________________________________
[hidden email] 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.

Rplots.pdf (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Additional polymath query

David Winsemius

> On Jan 2, 2016, at 9:53 AM, David Winsemius <[hidden email]> wrote:
>
>
>> On Jan 2, 2016, at 8:52 AM, Fisher Dennis <[hidden email]> wrote:
>>
>> R 3.2
>> OS X
>>
>> Colleagues
>>
>> Yesterday, I asked:
>> I have a polymath label for a graphic:
>> bquote(AUC[0-infinity]~(ng/ml~x~hours))
>> I would like the “x” to be replaced with a bullet.  
>>
>> David Winsemius provided an answer:
>> %.%
>> (which is also known as “cdot”)
>>
>> That works but the dot is small — I would prefer something bolder.  
>> Further searching led to the following:
>> plot(1, xlab="\u25CF")
>>
>> Now I can’t figure out how to incorporate
>> \u25CF
>> into the original command (to replace the “x” below):
>> bquote(AUC[0-infinity]~(ng/ml~x~hours))
>>
>> As much as I enjoy plotmath, it remains a bit of a mystery to me.  Any advice would be appreciated.
>
> The `?plotmath` help page also refers you to the help page on `?points`. I have on several occasions used the last example on that page to create an annotated table of glyphs associated with the Symbol font "characters" in the higher ranges of values:
>
> pdf(); TestChars <- function(sign = 1, font = 1, ...)
> {
>   MB <- l10n_info()$MBCS
>   r <- if(font == 5) { sign <- 1; c(32:126, 160:254)
>       } else if(MB) 32:126 else 32:255
>   if (sign == -1) r <- c(32:126, 160:255)
>   par(pty = "s")
>   plot(c(-1,16), c(-1,16), type = "n", xlab = "", ylab = "",
>        xaxs = "i", yaxs = "i",
>        main = paste( "Mac Symbol: points example", sprintf("sign = %d, font = %d", sign, font)))
>   grid(17, 17, lty = 1) ; mtext(paste("MBCS:", MB))
>   for(i in r) {
>         try(points(i%%16, i%/%16, pch = sign*i, font = font,...))
>         try(text(i%%16 -.3, i%/%16-.3, labels = i,cex=.6)) }
> }
>
> TestChars(font = 5); dev.off()
>
> <Rplots.pdf>

Duncan Murdoch's advice is relevant here: " You do need to be a little careful here: not all graphics devices support all Unicode characters."

The code above prompted a waring that:

1: In plot.xy(xy.coords(x, y), type = type, ...) :
  font width unknown for character 0xf0

Character 0xF0 is decimal 240 which is ironically enough the Apple logo symbol. It does print to the interactive device on a Mac and to the png()-device but not to the pdf()-device.

I get this for the first few names of pdfFonts:

>  names(pdfFonts())
 [1] "serif"                "sans"                 "mono"                
 [4] "AvantGarde"           "Bookman"              "Courier"    

So maybe my table was mislabeled and it is for "Bookman" rather than Symbol? We've now exceeded my knowledge of the various moving parts of the Mac-R graphics interface.



--
David.

>
> Looks to me that the 183 glyph might be to your liking. `points` has a 'cex' parameter that could be used to embolden it further if needed.
>
> --
> David.
>
>>
>> Dennis
>>
>> Dennis Fisher MD
>> P < (The "P Less Than" Company)
>> Phone: 1-866-PLessThan (1-866-753-7784)
>> Fax: 1-866-PLessThan (1-866-753-7784)
>> www.PLessThan.com
>>
>> ______________________________________________
>> [hidden email] 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.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> [hidden email] 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.

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.