rrJosh
unread,Mar 30, 2011, 5:41:00 PM3/30/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggplot2
UseRs,
I'm having issues with preservation of number formats in saved pdfs,
specifically with the euro symbol.
I stepped through the same process with the "dollar" and "percent"
format functions to see if the problem is isolated to my "euro"
function, which it appears to be.
Here is my example, first with the functional "dollar" instance:
library(ggplot2)
x <- seq(0,10,1)
y <- seq(0, 1000000, 100000)
qplot(x,y, geom = "line") + scale_y_continuous(formatter = "dollar")
pdf("file.pdf")
par(ask = F)
qplot(x,y, geom = "line") + scale_y_continuous(formatter = "dollar")
dev.off()
# Inspecting the saved pdf, the dollar formatting is fine. moving
on...
# NOW...similar to the "dollar" function to format numbers as french
Euros (e.g., 1 000 000,00 €):
euro <- function(x) {
paste(format(x, big.mark = " ", decimal.mark = ",", trim = TRUE,
scientific = FALSE)," €", sep = "") # entered using ALT + Shift + 2
}
qplot(x,y, geom = "line") + scale_y_continuous(formatter = "euro")
# everything should look fine in the quartz device.
pdf("file.pdf")
par(ask = F)
qplot(x,y, geom = "line") + scale_y_continuous(formatter = "euro")
dev.off()
# Inspecting the saved pdf, the " €" as been converted to "...",
citing the following in the warning messages: Warning messages:
# 1: In grid.Call("L_textBounds", as.graphicsAnnot(x$label), ... :
# conversion failure on '0 €' in 'mbcsToSbcs': dot substituted for
<e2>
Any ideas?
Thanks,
Josh