I have an axis title split over two lines using expression
in the plotmath
package (I am using expression
as I need half of my title in plain text and half in bold).
I need to include the character "à" in the title (it's in french), but the following code does not work:
xlab(expression(atop(first_line,bold(Age~"\u00E0"~la~"1e"~naissance))))
producing the following error message:
Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y, :
Metric information not available for this family/device
Edit : Workable example:
library(ggplot2)
data<-as.data.frame(c("a","b","c","a","b","c"))
colnames(data)<-"Y"
data$X<-c(1:6)
data$Z<-c(1,2,3,1,2,3)
ggplot(data, aes(x=X)) +
geom_line(aes(y = Z), size=0.43) +
xlab(expression(atop(top,bold(Age~"à"~la~"1e"~naissance))))
Session info:
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 grid_2.15.2 gtable_0.1.2 labeling_0.2
[7] MASS_7.3-23 munsell_0.4.2 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 reshape2_1.2.2
[13] scales_0.2.3 stringr_0.6.2 tools_2.15.2