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

Bert Gunter gunter.berton at gene.com
Thu Dec 29 23:48:04 CET 2011


Tal:

Does the "adj" argument for ?par (and also in text()) not do this for you?

Incidentally, gMail (on Windows) correctly rendered the Hebrew
("Shalom Olam"), so it would seem that this probably is a plotting
issue rather than an OS issue. However, I confess that my knees turn
to jelly with discussions of locales and non-"standard:" fonts, so
maybe I'm wrong about this.

Cheers,
Bert

On Thu, Dec 29, 2011 at 2:18 PM, Tal Galili <tal.galili at gmail.com> wrote:
> Thank you for the reply Jean, but no, it would not fix it :)
>
> plot(1:10, main=rev.string("שלום (עולם)"))
>
> What would "fix" it is if I had added a number after the parenthesis, but
> that is a hack, not a solution...
> plot(1:10, main="שלום (עולם) 1")
>
>
>
> ----------------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 Fri, Dec 30, 2011 at 12:12 AM, Jean V Adams <jvadams at usgs.gov> wrote:
>
>>
>> Tal Galili wrote on 12/29/2011 10:52:55 AM:
>>
>>
>> > 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)
>> >
>> ----------------------------------------------------------------------------------------------
>>
>>
>> I'm not sure if this is what you're after, but this function reverses the
>> string, character by character and swaps parentheses around.
>>
>> rev.string <- function(x) {
>>         revx.indiv <- rev(unlist(strsplit(x, "")))
>>         revx.indiv2 <- revx.indiv
>>         revx.indiv2[revx.indiv=="("] <- ")"
>>         revx.indiv2[revx.indiv==")"] <- "("
>>         paste(revx.indiv2, collapse="")
>>         }
>> plot(1:10, main=rev.string("ש×?×?× (×?קס×?)"))
>>
>>
>> Jean
>
>        [[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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list