[R] Strange axis labels?

Anon. bob.ohara at helsinki.fi
Mon Dec 23 18:16:03 CET 2002


Moi!

I'm trying to add a rather long label to a y-axis, and it's so long that
it won't fit into one line.  However, things get strange when I try and
split it over 2 lines.  The problem seems to be the plus/minus symbol,
which means I have to use expression().  I'm using R1.6.1 on Windoze
2000.

As an example:

thing1 <- expression(paste("log odds of survival probability ( " %+-%
"95% C.I.)", sep="     ")
thing2 <- expression(paste("log odds of survival probability \n( " %+-%
"95% C.I.)"))

plot(c(1,2), c(1,2), ylab=thing1)
par(mar =c(2.1, 6.1, 2.1, 2.1)); plot(c(1,2), c(1,2), ylab=thing2)

The first plot has the label on one line, with only a single space
between the bracket and the +/-.  Tbis is what I want, but I wonder why
paste has a sep=, if it doesn't do anything (I assume I've missed
something here).

The second plot has the label on 2 lines (you need the par() to get it
all in!), but the open bracket, "(", lines up with the start of the
first lines, and there is then a large gap, and the string continues
with the plus/minus below and to the right of the final part of the
first line.  Not what I expected at all.  Can anyone explain what's
going on, and how to remove this large space?

Thanks!

Bob

-- 
Bob O'Hara

Rolf Nevanlinna Institute
P.O. Box 4 (Yliopistonkatu 5)
FIN-00014 University of Helsinki
Finland

tel: +358 9 191 23743      mobile: +358 50 599 0540
fax: +358 9 191 22779    email: bob.ohara at helsinki.fi

It is being said of a certain poet, that though he tortures the English
language, he has still never yet succeeded in forcing it to reveal his
meaning
- Beachcomber




More information about the R-help mailing list