[R] Correct Localized Numbers on Plots, related to glibc!

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jan 15 12:07:39 CET 2012


You need to read ?Sys.setlocale (surely part of the homework the R 
posting guide asked of you).

It is vital that you give the 'at a minimum' information requested in 
the posting guide when asking such questions, and we also absolutely 
need to know what graphics device you are trying to use.

On 15/01/2012 08:26, Majid Einian wrote:
> Dear R Helpers,
>
> I want to localize my plots, i.e. the numbers by x&  y axis be
> Persian, using Persian numerals and Persian decimal separator. I
> change the locale to fa_IR.utf8, but nothing on plots change. I can

How, precisely?  Please show us exactly what you did, with a 
reproducible example.

> change the numerals shaping to Persian ones (۱۲۳۴ instead of 1234)
> using some non-standard fonts but the decimal point is a problem. I
> asked about that in Persian-Computing mailing list and I got the
> answer that follows. I don't know how should I use this "l" flag
> mentioned in the answer in R plots (I'm using simple R plots, no
> special library).
>
> Has anybody had similar problem in any language (maybe Arabic, other
> languages I'm not sure use different numeral characters).
> Also I don't have e.g. French locale on my system to see if the
> decimal separator changes accordingly to locale for them.

It will if they followed the documentation.

> Thanks in advance.
>
> -----------------------------------------------------------------------------
>   Roozbeh Pournader<roozbeh at gmail.com>	Tue, Dec 6, 2011 at 3:47 AM
> To: Majid Einian<einian85 at gmail.com>
> Cc: persian-computing at googlegroups.com
>
> The glibc model for generating numbers is kind of complex. For using
> native digits, one is supposed to use the "I" flag. For example, in
> order to get ۱۲٫۳, you should do printf("%I.1f", 12.3).
>
> This is to make sure applications have a way to output both ASCII
> numbers, and native numbers.
>
> Roozbeh
>
>


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



More information about the R-help mailing list