[R] Additional polymath query

David Winsemius dwinsemius at comcast.net
Sat Jan 2 19:17:03 CET 2016


> On Jan 2, 2016, at 9:53 AM, David Winsemius <dwinsemius at comcast.net> wrote:
> 
> 
>> On Jan 2, 2016, at 8:52 AM, Fisher Dennis <fisher at plessthan.com> 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
>> 
>> ______________________________________________
>> 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list