How do I make Lithuanian characters display correctly in R graphics? Instead of the special characters for Lithuanian language I get question marks... I use Ubuntu Feisty, the locale is utf-8 ... Do I need to specify somewhere the locale for R, or - default font for the graphics? -- Donatas Glodenis http://dg.lapas.info
On Fri, 13 Jul 2007, Donatas G. wrote:> How do I make Lithuanian characters display correctly in R graphics? > > Instead of the special characters for Lithuanian language I get question > marks... > > I use Ubuntu Feisty, the locale is utf-8 ... > > Do I need to specify somewhere the locale for R, or - default font for the > graphics?See ?X11, especially the 'Fonts' section (assuming that is the graphics device you are using: you did not actually say but that is the device most likely to be giving question marks or empty rectangles for missing glyphs). -- 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
Donatas G. wrote:> How do I make Lithuanian characters display correctly in R graphics? > > Instead of the special characters for Lithuanian language I get question > marks... > > I use Ubuntu Feisty, the locale is utf-8 ... > > Do I need to specify somewhere the locale for R, or - default font for the > graphics? >You mean as in> plot(0,main="\u104\u116\u0118\u012e\u0172\u016a\u010c\u0160\u017d") >plot(0,main=tolower("\u104\u116\u0118\u012e\u0172\u016a\u010c\u0160\u017d")) ? This works fine for me on OpenSUSE 10.2, so I don't think the issue is in R. More likely, this has to do with X11 fonts (Unicode is handled via a rather complicated mechanism involving virtual fonts). Postscript/PDF is a bit more difficult. See ?postscript and the reference to Murrell+Ripley's R News article inside. The correct incantation seems to be postscript(font="URWHelvetica", encoding="ISOLatin7") plot(0,main=tolower("\u104\u116\u0118\u012e\u0172\u016a\u010c\u0160\u017d")) dev.off() -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907