Hi,
I am trying to produce a ggplot graph using specific characters in the
labels, but ggplots doesn't seem to support certain symbols.
For example, when I type:
print("\u25E9")
it shows a square which is half black, but when I try to use it in ggplot
it doesn't print.
I am using facet_wrap, but it looks like the problem is in ggplot that
doesn't recognise the Unicode symbols and not factet_wrap (please let me
know if it is otherwise).
I am taking this very helpful example for illustration (
http://r.789695.n4.nabble.com/plus-minus-in-factor-not-plotmath-not-expression-td4681490.html
):
junk<-data.frame(gug=c(
rep( paste("\u25E9"), 10),
rep( paste("\u25E8"), 10)
)
)
junk$eks<-1:nrow(junk)
junk$why<-with(junk, as.numeric(gug) + eks)
print(summary(junk))
library(ggplot2)
print(
ggplot(data=junk, mapping=aes(x=eks, y=why))
+ geom_point()
+ facet_grid(. ~ gug)
)
Is there a way to have R recognise these Unicode symbols? It is not math
symbols so plotmath will not be useful here...
I'm using a Mac and this is the SessionInfo:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Unicode_0.1-3 ggplot2_0.9.3.1 plyr_1.8 reshape2_1.2.2
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 grid_3.0.2
[5] gtable_0.1.2 labeling_0.2 MASS_7.3-29 munsell_0.4.2
[9] proto_0.3-10 RColorBrewer_1.0-5 scales_0.2.3 stringr_0.6.2
[13] tcltk_3.0.2 tools_3.0.2
Thank you very much for your help!
[[alternative HTML version deleted]]