[R] Is it possible to "right align" text in R graphics?

Hadley Wickham hadley at rice.edu
Tue Jan 3 23:51:50 CET 2012


FYI, if you're looking for the technical term for this type of text it's bidi:
http://en.wikipedia.org/wiki/Bi-directional_text

Hadley

On Tue, Jan 3, 2012 at 4:32 PM, Tal Galili <tal.galili at gmail.com> wrote:
> And I forgot to include the link to the image, here it is:
>
> http://dl.dropbox.com/u/5371432/right-to-left-text%20example%202.png
>
>
>
>
>
>
> On Wed, Jan 4, 2012 at 12:30 AM, Tal Galili <tal.galili at gmail.com> wrote:
>
>> Thanks to an e-mail from David, I realized that non-Hebrew speakers will
>> not be able to know how a proper right-to-left output should look like
>> (sorry for not thinking about it myself...)
>>
>> Here is some example code of how the output should look like vs how it
>> currently looks.
>> This is shown only for the main parameter, but the same issue will come up
>> when using ?title or ?text
>>
>> Two points to mention again:
>> 1) This is not a huge problem for me personally, but I believe that in the
>> long term, if such an issue can be fixed, it would have been nice.  It will
>> allow all of the right-to-left languages to use R for plotting in their own
>> language (That included, for example, all of the Arabic world...
>> http://en.wikipedia.org/wiki/Right-to-left ).
>> 2) I fear that this type of issue needs to be handled by someone familiar
>> with the guts of the R graphics code.  I am not even sure if I should post
>> this here or on the R-devel mailing list.  Your advise will be very welcome.
>>
>>
>> Here is the example code:
>>
>> par(mfrow = c(1,2))
>> plot(1:10, main = "שלום (טקסט)", sub = "The order of text is not right to
>> left")
>> plot(1:10, main = "(שלום (טקסט", sub = "This is how the output should have
>> looked like")
>>
>> # A more complex example:
>> plot(1:10, main = "שלום (טקסט) מידע על Subject 1", sub = "The order of
>> text is not right to left")
>> plot(1:10, main = " Subject 1 שלום (טקסט) מידע על", sub = "This is how the
>> output should have looked like")
>>
>> # An even more complex example:
>> par(mfrow = c(1,1))
>> plot(1:10, main = "שלום (טקסט) מידע על Subject 1 וגם קצת מידע על subject
>> 2", sub = "The order of text is not right to left")
>> # I am not sure how to fix this actually...
>>
>>
>> Happy new year,
>> Tal
>>
>>
>> ----------------Contact
>> Details:-------------------------------------------------------
>> Contact me: Tal.Galili at gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> ----------------------------------------------------------------------------------------------
>>
>>
>>
>>
>> On Thu, Dec 29, 2011 at 6:52 PM, Tal Galili <tal.galili at gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> The following line of code includes a right-to-left language text, yet
>>> the R graphics engine displays it from left to right.  One problem this
>>> causes is when there are parenthesis in the test, here is a basic example?
>>>
>>> plot(1:10, main = "שלום (טקסט)")
>>>
>>> Is there a way to make sure the text is displayed from right to left?
>>>
>>> Many thanks for any suggestions,
>>> Tal
>>>
>>>
>>> ----------------Contact
>>> Details:-------------------------------------------------------
>>> Contact me: Tal.Galili at gmail.com |  972-52-7275845
>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>>> www.r-statistics.com (English)
>>>
>>> ----------------------------------------------------------------------------------------------
>>>
>>>
>>>
>>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list