ggplot to pdf formatting issue: "€" - Euro symbol

509 views
Skip to first unread message

rrJosh

unread,
Mar 30, 2011, 5:41:00 PM3/30/11
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

Pierre Roudier

unread,
Mar 30, 2011, 9:40:09 PM3/30/11
to rrJosh, ggplot2
Hi Josh,

Haven't tested myself, but I would have a look to the encoding option
of the pdf() function.

See ?postscript

HTH,

Pierre

2011/3/31 rrJosh <joshle...@gmail.com>:

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

--
Scientist
Landcare Research, New Zealand

Adam_L...@keybank.com

unread,
Mar 31, 2011, 10:49:24 AM3/31/11
to rrJosh, ggplot2

FYI:

Not sure how to help, but I can confirm that it works on my machine - the Euro format in the PDF looks fine.



Adam Loveland





rrJosh <joshle...@gmail.com>
Sent by: ggp...@googlegroups.com

03/30/2011 05:41 PM

To
ggplot2 <ggp...@googlegroups.com>
cc
Subject
ggplot to pdf formatting issue: "€" - Euro symbol





--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2




This communication may contain privileged and/or confidential information. It
is intended solely for the use of the addressee. If you are not the intended
recipient, you are strictly prohibited from disclosing, copying, distributing
or using any of this information. If you received this communication in error,
please contact the sender immediately and destroy the material in its entirety,
whether electronic or hard copy. This communication may contain nonpublic personal
information about consumers subject to the restrictions of the 
Gramm-Leach-Bliley Act. You may not directly or indirectly reuse or redisclose
such information for any purpose other than to provide the services for which
you are receiving the information.

127 Public Square, Cleveland, OH 44114



If you prefer not to receive future e-mail offers for products or services from Key
send an e-mail to mailto:DNERe...@key.com with 'No Promotional E-mails' in the
SUBJECT line.
Reply all
Reply to author
Forward
0 new messages