Skip to content

Plot alignment with mtext

3 messages · Kevin Burton, Sarah Goslee

#
Hi Kevin,
On Tue, Nov 15, 2011 at 2:36 PM, Kevin Burton <rkevinburton at charter.net> wrote:
You don't provide any of the info in the posting guide (OS may be
important here), or a reproducible example, which would also be
helpful.

But see below anyway.
The default font used for titles is not proportionally spaced, at
least on my linux
system, so of course they won't line up.

Try:

a <- c("                    ME         RMSE          MAE       MPE
 MAPE      MASE",
"original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554  37.47713
1.5100050",
"xreg      1.561235e+01 2.008599e+03 9.089473e+02 267.05490 280.66734
0.9893643")

par(mfcol=c(2,1), oma=c(0,0,4,0))
plot(1:10, 1:10)
plot(1:10, 1:10)

par(family="mono")
mtext(a[1], line= 1, side=3, outer=TRUE)
mtext(a[2], line= 0, side=3, outer=TRUE)
mtext(a[3], line=-1, side=3, outer=TRUE)

Or whatever the appropriate font family specification for your OS is.

Sarah
#
I hadn't considered altering the font. Thank you I will try that.

-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com] 
Sent: Tuesday, November 15, 2011 1:53 PM
To: Kevin Burton
Cc: r-help at r-project.org
Subject: Re: [R] Plot alignment with mtext

Hi Kevin,

On Tue, Nov 15, 2011 at 2:36 PM, Kevin Burton <rkevinburton at charter.net>
wrote:
You don't provide any of the info in the posting guide (OS may be important
here), or a reproducible example, which would also be helpful.

But see below anyway.
? ? ?
column)?

The default font used for titles is not proportionally spaced, at least on
my linux system, so of course they won't line up.

Try:

a <- c("                    ME         RMSE          MAE       MPE
 MAPE      MASE",
"original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554  37.47713
1.5100050",
"xreg      1.561235e+01 2.008599e+03 9.089473e+02 267.05490 280.66734
0.9893643")

par(mfcol=c(2,1), oma=c(0,0,4,0))
plot(1:10, 1:10)
plot(1:10, 1:10)

par(family="mono")
mtext(a[1], line= 1, side=3, outer=TRUE) mtext(a[2], line= 0, side=3,
outer=TRUE) mtext(a[3], line=-1, side=3, outer=TRUE)

Or whatever the appropriate font family specification for your OS is.

Sarah



--
Sarah Goslee
http://www.functionaldiversity.org