Hi, I need to add on a plot text containing italic Greek characters using the function mtext (i.e. I cannot use Hershey vectors). The characters are nicely displayed when the file is saved as png but not when saved as eps. See code below as example: #postscript('test.eps') png('test.png') plot(1,1, type = 'n') mtext(side = 3, line = 2, expression(italic('\u03bc'))) graphics.off() Does anyone have an idea on how to solve this issue? FYI I use R 2.10.1 for Max OS X (v. 10.6.3) but this is not an OS related issue (I have also tried with Windows). Many many thanks in advance, - Julia -- Julia Uitz Scripps Institution of Oceanography University of California San Diego
Prof Brian Ripley
2010-Apr-20 05:30 UTC
[R] How to embed italic Greek letters in a eps file?
This is discussed in detail on the help page for postcript! Default PostScript with the 14 standard fonts does not cover Greek at all (but it does cover mathematical symbols such as mu, in a different typeface). See the section 'Encodings': to display Greek you need to have an encoding which supports Greek. You did not give us the 'at a minimum' information requested in the posting guide so we don't know your locale, but at a guess you got ISOLatin1, which does not support Greek. So try encoding="Greek" and family="URWHelvetica", and make sure that your viewer is able to support the font. On Mon, 19 Apr 2010, Julia Uitz wrote:> Hi, > > I need to add on a plot text containing italic Greek characters using the > function mtext (i.e. I cannot use Hershey vectors). The characters are nicely > displayed when the file is saved as png but not when saved as eps. See code > below as example: > > #postscript('test.eps') > png('test.png') > > plot(1,1, type = 'n') > mtext(side = 3, line = 2, expression(italic('\u03bc'))) > > graphics.off() > > Does anyone have an idea on how to solve this issue? > > FYI I use R 2.10.1 for Max OS X (v. 10.6.3) but this is not an OS related > issue (I have also tried with Windows). > > Many many thanks in advance, > > - Julia > > -- > Julia Uitz > Scripps Institution of Oceanography > University of California San Diego > > ______________________________________________ > R-help at 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, 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