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.

#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?

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
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to