[R] remove margin between plot and axis
murdoch.duncan at gmail.com
Tue Jan 29 14:19:29 CET 2013
On 13-01-29 7:51 AM, e-letter wrote:
> On 29/01/2013, Pascal Oettli <kridox at ymail.com> wrote:
>> Please provide a reproducible example.
That's probably not doing what you think it does because you used a
colon instead of a comma.
The parameter "mai" matches "main", so this gives you a funny 3 line
title. To set the margins you should probably use "mar" (measured in
lines) rather than "mai" (measured in inches), and you should give
values for all 4. You should also do it with par(). For example,
save <- par(mar=c(0,1,1,0))
It looks terrible (size zero margins don't work well), but fiddling with
the "mar" numbers should get you what you want.
However, I don't think the margins are what you want.
> but this has the non-wanted effect of removing white space from
> between the highest peak and the upper (top) axis
This isn't a style that's automatically supported within R, but you can
fake it with a little work. Use the 'i' style, but set the upper y
limit above the data. For example,
yrange <- range(test)
ylim <- yrange + c(0, 1.04*diff(yrange))
plot(test, type='h', yaxs='i', ylim=ylim)
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help