Many thanks Dr. Ripley. I was made aware that the problem for me was that I was sending HTML in my email message. Transgression noted.
On Wed, Jun 29, 2011 at 10:17 PM, Prof Brian Ripley <rip...@stats.ox.ac.uk>wrote: > On Wed, 29 Jun 2011, Sam Albers wrote: > > I know that this has been asked before in other variations but I just >> can't >> seem to figure out my particular application from previous posts. My >> apologies if I have missed the answer to this question somewhere in the >> archives. I have indeed looked. >> >> I am running Ubuntu 11.04, with R 2.12.1 and ESS+Emacs. >> >> For journal formatting requirements, I need to italicize all the greek >> letters in any plot. This is reasonably straight forward to do and I >> accomplished this task like so: >> >> library(ggplot2) >> >> label_parseall <- function(variable, value) { >> plyr::llply(value, function(x) parse(text = paste(x))) >> } >> >> dat <- data.frame(x = runif(270, 0, 125), z = rep(LETTERS[1:3], each = 3), >> yy = 1:9, stringsAsFactors = TRUE) >> #unicode italicized delta >> dat$gltr = >> factor(c("italic(\u03b4)^14*N"**,"italic(\u03b4)^15*N","** >> italic(\u03b4)^13*C")) >> >> #So this is what I want my plot to look like: >> plt <- ggplot(data = dat, aes(x = yy, y = x)) + >> geom_point(aes(x= yy, y=x, shape=z, group=z), alpha=0.4,position = >> position_dodge(width = 0.8)) + >> facet_grid(gltr~.,labeller= label_parseall, scales="free_y") >> plt >> >> #So then I exported my plot as a PDF like so: >> pdf("Times_regular.pdf", family='Times') >> plt >> dev.off() >> #The problem with this was that the delta symbols turned into dots. >> > > You forgot to set the encoding: see the ?pdf help file. Greek is most > likely not covered by the default encoding (and you also forgot the 'at a > minimum' information required by the posting guide, so we don't know what > your defaults would be). > > > Here is the results of sessionInfo(). Is this what you meant by defaults? > sessionInfo() R version 2.12.1 (2010-12-16) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_CA.UTF-8 [7] LC_PAPER=en_CA.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets grid methods [8] base other attached packages: [1] Cairo_1.4-9 ggplot2_0.8.9 reshape_0.8.4 plyr_1.5.2 proto_0.3-9.2 loaded via a namespace (and not attached): [1] digest_0.4.2 I also tried using all the encodings found /usr/lib/R/library/grDevices/enc AdobeStd.enc CP1250.enc CP1253.enc Cyrillic.enc ISOLatin1.enc ISOLatin7.enc KOI8-R.enc MacRoman.enc TeXtext.enc AdobeSym.enc CP1251.enc CP1257.enc Greek.enc ISOLatin2.enc ISOLatin9.enc KOI8-U.enc PDFDoc.enc WinAnsi.enc None of these seemed to produce italicized greek letters. It seems like encoding is ignored in CairoPDF so I never tried it with that command. > #I solved this problem using Cairo >> library(Cairo) >> cairo_pdf("Cairo.pdf") >> plt >> dev.off() >> >> >> The problem that I face now is that I am unsure how to output a figure >> that >> maintains the greek symbols but outputs everything in the plot as TImes >> New >> Roman, another requirement of the journal. So I can produce a Times New >> Roman PDF plot and an italicize greek symbol unicode PDF plot but not >> both. >> Does anoyone have any idea how I might accomplish both of these things >> together in a single PDF? >> > > I woud use cairo_pdf() in base R (and not package Cairo). Use grid > facilities to change font, or use the version in R-devel which has a family= > argument. > > I tried this using CairoPDF() like so: CairoPDF("Cairo.pdf", 6, 6, family="Times") plt dev.off() But this omitted the greek symbols AND didn't produce the figure in the desired font. It seems like other folks have also experienced this problem before: https://stat.ethz.ch/pipermail/r-help/2011-January/266657.html Have I missed something? Are there any other strategies that could suggest to get italicized greek letters? Thanks again. Sam > >> Thanks so much in advance, >> >> Sam >> >> [[alternative HTML version deleted]] >> > > ______________________________**________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide http://www.R-project.org/** >> posting-guide.html <http://www.R-project.org/posting-guide.html> >> > > That does mean you! > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Professor of Applied Statistics, > http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/> > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.