I can't figure out how to use the Euclidean norm symbol in R plot annotation. (I am aware of plotmath and use it). Anyone can help?
Asked
Active
Viewed 353 times
1
-
1Hi, can you provide a (reproducible example)[http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example]? – Heroka Aug 25 '15 at 13:48
1 Answers
3
You can use Unicode symbol 2016:
plot(1:10,1:10,xlab=expression("\u2016"*x*"\u2016"))
This works for me with X11 graphics under Ubuntu with an en_CA.utf8 locale, but you might have some trouble getting it exported portably under PDF etc. (maybe try the PDF driver from the Cairo
package ...). An alternative would be to use TikZ, but that has a lot of overhead too ...

Ben Bolker
- 211,554
- 25
- 370
- 453
-
Simple and nice, didn't realize that I can put the unicode character directly. Thanks! – retrot Aug 25 '15 at 14:04
-
btw, for me it gets perfectly exported to pdf with the function cairo_pdf() instead of the usual pdf() – retrot Aug 25 '15 at 14:09
-
Doesn't quite work for me on Windows 7. Probably has something to do with my fonts... but `plot(1:10,1:10,xlab=expression("||"*x*"||"))` works though. I'm guessing that isn't quite the same but looks good enough to me. – Dason Aug 25 '15 at 14:12