Discussion:
[R] changing text direction of mtext
squall44
2007-08-24 06:34:09 UTC
Permalink
Hello,

Does anyone know if it's possible to change the text direction of mtext?

I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.

I couldn't find an argument for that in the help files.

Thanks for any suggestions
Tobias
--
View this message in context: http://www.nabble.com/changing-text-direction-of-mtext-tf4321931.html#a12307342
Sent from the R help mailing list archive at Nabble.com.
Matthew Walker
2007-08-24 06:46:53 UTC
Permalink
You might like to try par(las=1).

Cheers,

Matthew
Post by squall44
Hello,
Does anyone know if it's possible to change the text direction of mtext?
I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.
I couldn't find an argument for that in the help files.
Thanks for any suggestions
Tobias
Uwe Ligges
2007-08-24 06:51:13 UTC
Permalink
Post by squall44
Hello,
Does anyone know if it's possible to change the text direction of mtext?
I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.
I couldn't find an argument for that in the help files.
It's just one help file you have to read: ?mtext. Please also read the
introductory R manuals (and maybe look into some good textbook on R).
Since we all do know now that you cannot read help pages, I read ?mtext
for you:

In section Arguments:
"... Further graphical parameters (see par), including family, las and
xpd. (This defaults to the figure region unless outer = TRUE, otherwise
the device region. It can only be increased.) "

In section Details:
"Parameter las will determine the orientation of the string(s). For
strings plotted perpendicular to the axis the default justification is
to place the end of the string nearest the axis on the specified line.
(Note that this differs from S, which uses srt if at is supplied and las
if it is not.)"

Please also note that you can look into the R-help archives before
posting questions that have been answered dozens of times already - as
the posting guide to this list asks you to do.

Uwe Ligges
Post by squall44
Thanks for any suggestions
Tobias
squall44
2007-08-24 08:11:08 UTC
Permalink
Thanks for your answers, Matthew and Uwe.

I used...

par(las=1)
mtext(side=2)

...and then I adjusted it using 'padj'.

The problem is that if I change the proportions of the graph, the mtext will
move up or down (relativly to the y-axis).

By not using 'par', I can use 'adj' instead of 'padj' to adjust the mtext
vertically. That way, the mtext not move relativly to the y-axis.

Can anyone help me to get around this problem, please?
Thx Tobias
Post by squall44
Hello,
Does anyone know if it's possible to change the text direction of mtext?
I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.
I couldn't find an argument for that in the help files.
Thanks for any suggestions
Tobias
--
View this message in context: http://www.nabble.com/changing-text-direction-of-mtext-tf4321931.html#a12308320
Sent from the R help mailing list archive at Nabble.com.
Matthew Walker
2007-08-24 09:14:25 UTC
Permalink
Perhaps then you would rather use the axis() command?

Say you wanted the text "hello" to be placed at y=0.5, then you might try
Post by Matthew Walker
par(las=1)
axis(side=2, at=0.5, label="hello")
Cheers,

Matthew
Post by Matthew Walker
Thanks for your answers, Matthew and Uwe.
I used...
par(las=1)
mtext(side=2)
...and then I adjusted it using 'padj'.
The problem is that if I change the proportions of the graph, the mtext will
move up or down (relativly to the y-axis).
By not using 'par', I can use 'adj' instead of 'padj' to adjust the mtext
vertically. That way, the mtext not move relativly to the y-axis.
Can anyone help me to get around this problem, please?
Thx Tobias
Post by squall44
Hello,
Does anyone know if it's possible to change the text direction of mtext?
I'd like to use 'mtext(side=2)' but the text should be 'left-to-right'.
I couldn't find an argument for that in the help files.
Thanks for any suggestions
Tobias
Loading...