Readers, Am trying to plot a graph with type 'h' and want to remove the white space between the plot lines and the x axis. The help section 'par' suggests that the option 'mai' controls this feature, but the syntax plot(...mai=c(0,1,1)) is ineffective Any advice please? -- r2151
remove margin between plot and axis
6 messages · Pascal Oettli, e-letter, Ivan Calandra +2 more
Hi, Please provide a reproducible example. Regards, Pascal Le 29/01/2013 19:40, e-letter a ?crit :
Readers, Am trying to plot a graph with type 'h' and want to remove the white space between the plot lines and the x axis. The help section 'par' suggests that the option 'mai' controls this feature, but the syntax plot(...mai=c(0,1,1)) is ineffective Any advice please? -- r2151
______________________________________________ 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.
On 29/01/2013, Pascal Oettli <kridox at ymail.com> wrote:
Hi, Please provide a reproducible example.
test<-seq(10:50) plot(test,type='h',mai=c(0,1,1)) Tried plot(test,type='h',yaxs='i') but this has the non-wanted effect of removing white space from between the highest peak and the upper (top) axis
Not sure wat you're trying to do... Can you explain more what you expect your plot to look like? What about plot(..., frame=FALSE)? Ivan -- Ivan CALANDRA Universit? de Bourgogne UMR CNRS/uB 6282 Biog?osciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calandra at u-bourgogne.fr http://biogeosciences.u-bourgogne.fr/calandra Le 29/01/13 13:51, e-letter a ?crit :
On 29/01/2013, Pascal Oettli <kridox at ymail.com> wrote:
Hi, Please provide a reproducible example.
test<-seq(10:50) plot(test,type='h',mai=c(0,1,1)) Tried plot(test,type='h',yaxs='i') but this has the non-wanted effect of removing white space from between the highest peak and the upper (top) axis
______________________________________________ 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.
On 13-01-29 7:51 AM, e-letter wrote:
On 29/01/2013, Pascal Oettli <kridox at ymail.com> wrote:
Hi, Please provide a reproducible example.
test<-seq(10:50)
That's probably not doing what you think it does because you used a colon instead of a comma.
plot(test,type='h',mai=c(0,1,1))
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)) plot(test, type='h') par(save) 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.
Tried plot(test,type='h',yaxs='i') 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[1] + c(0, 1.04*diff(yrange)) plot(test, type='h', yaxs='i', ylim=ylim) Duncan Murdoch
______________________________________________ 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.
Something like plot(test,type='h',yaxs='i', ylim = c(0, 60)) ? You would need to figure out what the right values for ylim are. John Kane Kingston ON Canada
-----Original Message----- From: inpost at gmail.com Sent: Tue, 29 Jan 2013 14:51:32 +0200 To: kridox at ymail.com Subject: Re: [R] remove margin between plot and axis On 29/01/2013, Pascal Oettli <kridox at ymail.com> wrote:
Hi, Please provide a reproducible example.
test<-seq(10:50) plot(test,type='h',mai=c(0,1,1)) Tried plot(test,type='h',yaxs='i') but this has the non-wanted effect of removing white space from between the highest peak and the upper (top) axis
______________________________________________ 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.
____________________________________________________________ GET FREE 5GB EMAIL - Check out spam free email with many cool features! Visit http://www.inbox.com/email to find out more!