2

After learning about the Unicode values for "Harvey Balls" , Harvey balls in R , I tried an alternative plotting approach. Strange things happen:

plot(1:10,t='n')
 text(1,1,c(intToUtf8(c(1,9684))),cex=3)
 text(2,2,c(intToUtf8(c(9684))),cex=3)
 text(3,3,c(intToUtf8(c(9679,9684))),cex=3)
 text(4,4,c(intToUtf8(c(9679))),cex=3)
 text(5,5,c(intToUtf8(c(9685,9684))),cex=3)
 text(6,6,c(intToUtf8(c(9682,9685))),cex=3)
 text(7,7,c(intToUtf8(c(9682,9675))),cex=3)
 text(8,8,c(intToUtf8(c(9682,9682))),cex=3)

resulting plot

I can't figure it out -- sometimes the Unicode values get recognized, and sometimes not; and it seems to depend heavily on the first value in my concatenation. The immediate problem is that I can't plot a specific Harvey Ball all by itself, but I'm more worried about the difficulty in getting text -- or maybe intToUtf8 to properly retrieve the desired symbol.

Any ideas?

edit: R 3.0.2, Windows7. I'm going to try to reproduce this later on when I can get to an OSX machine. In the meantime, success/failure stories greatfully accepted.

Community
  • 1
  • 1
Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73
  • I can't reproduce it. I ran the code and I see only the balls. I'm not sure what is the desired output, so it is possible that what I see is still wrong, but in a different way. (ok, I'm on R 3.0.2, Ubuntu 12.04LTS - might be the source of the difference) – amit Mar 06 '14 at 20:15
  • @amit I want to see various balls, but if the first number in my collection is `9684` or `9682` or `9685`, I get the default "empty square" drawn instead of a symbol. – Carl Witthoft Mar 06 '14 at 20:41
  • It's worse under OSX -- I only get the empty and filled circles (or dead squares) no matter what order. Something tells me there's a lot of "what fonts are really truly in the Operating System" going on here. – Carl Witthoft Mar 06 '14 at 22:12
  • You need to know which glyphs are in the particular font definitions on your machine. Very few fonts have the full set of glyphs. – IRTFM Mar 07 '14 at 01:18
  • FWIW the linked SO page's code w/ `extrafont` does work, at least on my OSX platform. – Carl Witthoft Mar 07 '14 at 01:48
  • I get the same results as you, and have run into this before. It's bizarre, maddening, and *has* to qualify as a bug. It's not just a matter of the graphics devices either, as I get similar results in the R gui's command line when I do this: `intToUtf8(c(9679)); intToUtf8(c(9684)); intToUtf8(c(9679, 9684))`. (Although if I paste those results into these comments, the "box" gets appropriately rendered *here* as a quarter-filled circle. – Josh O'Brien Mar 11 '14 at 21:13
  • See also my comments following [this question](http://stackoverflow.com/questions/14780860/fix-typography-in-axis-labels/14781725#14781725) for a possibly-related Windows UTF-8-handling deficiency. – Josh O'Brien Mar 11 '14 at 21:17
  • @JoshO'Brien Thanks for the info. Maybe the real answer is to switch to RedHat :-) (like my Corporate Overlords would allow that) – Carl Witthoft Mar 11 '14 at 21:27
  • Think it's worth me putting a bounty on this question, or would it be best to submit it as a possible bug to R-core? (And yes, sadly, I also think *NIX is the real answer ;=) – Josh O'Brien Mar 11 '14 at 21:37
  • @JoshO'Brien I'll do the bug report; feel free to bounty-ize if you think that'll get us anywhere ~_* – Carl Witthoft Mar 12 '14 at 15:35
  • 1
    For the record, Carl's bug official bug report (thanks) is [here](https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15712). – Josh O'Brien Mar 13 '14 at 18:59

0 Answers0