Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
plot(1,1,pch=-0x25D1L) plot(1,1,pch=-as.hexmode("25D1")) plot(1,1,pch=-0x25D1L)
all work equivalently.
TestUnicode <- function(start="25a0", end="25ff", ...) { nstart <- as.hexmode(start) nend <- as.hexmode(end) r <- nstart:nend s <- ceiling(sqrt(length(r))) par(pty="s") plot(c(-1,(s)), c(-1,(s)), type="n", xlab="", ylab="", xaxs="i", yaxs="i") grid(s+1, s+1, lty=1) for(i in seq(r)) { try(points(i%%s, i%/%s, pch=-1*r[i],...)) } } TestUnicode() TestUnicode(9500,9900) ## some cool spooky stuff in here!One thing to keep in mind is that you should test whatever symbols you decide to use carefully with whatever graphics path/display/printing solution you plan to use, as all platforms may not render all Unicode symbols properly. With a little more work I could change TestUnicode() to do proper indexing so that it would be easier to figure out which symbol was which. Watch for my next paper, in which I will use Unicode symbols 9748/x2614 ('UMBRELLA WITH RAIN DROPS'), 9749/x2615 ('HOT BEVERAGE'), 9763/x2623 ('BIOHAZARD SIGN'), and 9764/x2624 ('CADUCEUS') to represent my data ... Related links:
- Unicode symbol search
- Yu-Sung Su on plotting symbols
- Yihui Xe on using tikZ to embed TeX symbols in R graphics
PSThis worked fine on my primary 'machine' (Ubuntu 10.04 under VMWare on MacOS X.6), but under MacOS X.6 most of the symbols were not resolved. The friend for whom I worked this out has also stated that it didn't work under his (unstated) Linux distribution ... feel free to post in comments below if this works on your particular machine/OS combination. There is a remote possibility that this could be done with Hershey s as well (see this page on the R wiki for further attempts at symbol plotting), but I don't know how thorough the correspondence is between the Hershey s and the Unicode symbol set ...
PPSI asked about this on StackOverflow and got a useful answer from Gavin Simpson, referencing some notes by Paul Murrell: use cairo_pdf. This should work on any Linux installation with the Pango libraries, I think. In principle it could work on MacOS (and/or Windows?) with Pango installed as well, but I haven't tried ...
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.