Crump, Ron
unread,May 6, 2016, 9:38:26 AM5/6/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggp...@googlegroups.com
Hi,
I have data that contains the names of Brazilian states.
Some of these include accented characters, e.g. "Cear\xe1".
This is ok at the level of manipulating the data, but they don't show up
correctly in my ggplot graphs. For example, with facet_grid and the pdf
device "Cear\xe1" was rendered as "Cear.", on the screen (so a quartz
device on MacOSX) the name was dropped altogether. The \xe1 is an acute
accented a.
Here is a tiny example:
DF <- structure(list(state = c("Amazonas", "Amazonas", "Cear\xe1",
"Cear\xe1"), x = c(0, 1, 0, 1), y = c(0.5, 0.5, 0.5, 0.5)), .Names =
c("state",
"x", "y"), row.names = c(NA, -4L), class = "data.frame")
ggplot(DF)+geom_point(aes(x=x,y=y))+facet_wrap(~state)
I have attached a tiff screenshot of the quartz window and a PDF (pdf
device not ggsave). When writing to the pdf device I received 15 warnings
of the type:
In grid.Call(L_textBounds, as.graphicsAnnot(x$label), ... : conversion
failure on 'Cear·' in 'mbcsToSbcs': dot substituted for <e1>
Sys.getlocale() produces:
"en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8"
Any suggestions?
While I mention facet_grid, the state names may appear in other graphical
elements too as I go along, e.g. legends, axis labels. Is there a general
solution?
Cheers,
Ron.