[R] Control y axis

David L Carlson dcarlson at tamu.edu
Sun Jul 22 01:03:16 CEST 2012


Using x/yaxp also works:

plot(x, y, type ="o", xlab="Panelist", ylab="T value", lwd=1.5, 
    xaxp=c(0, 18, 9), yaxp=c(-8, 8, 8), las=1)

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of arun
> Sent: Saturday, July 21, 2012 2:16 PM
> To: Stefanie Wind
> Cc: R help
> Subject: Re: [R] Control y axis
> 
> Hi,
> No problem.
> 
> I was gettting -8 and 6 for the code I sent to you.  I am using R
> 2.15.
> 
> 
> This code gets -8 and 8 for the y axis:
>  x<-1:17
> > y<- -8:8
> >   plot(x, y, type ="o", xlab="Panelist", ylab="T
> value",lwd=1.5,axes=FALSE)
> > axis(1,at=c(0,2,4,6,8,10,12,14,16,18))
> > axis(2,at=c(-8,-6,-4,-2,0,2,4,6,8,10))
> A.K.
> 
> 
> 
> 
> ________________________________
> From: Stefanie Wind <wind.stefanie at gmail.com>
> To: arun <smartpink111 at yahoo.com>
> Sent: Saturday, July 21, 2012 9:48 AM
> Subject: Re: [R] Control y axis
> 
> 
> Nevermind - got it this way:
> 
> plot(x, y, type ="o", xlab="Panelist", ylab="T value", lwd=1.5,
> xlim=c(1,14), ylim=c(-
> 8,8), axes=FALSE)axis(1,at=c(0,2,4,6,8,10,12,14,16)) axis(2,at=c(-10,-
> 8,-6,-4,-2,0,2,4,6,8,10))
> 
> Thanks for your response yesterday!
> 
> 
> On Sat, Jul 21, 2012 at 9:24 AM, Stefanie Wind
> <wind.stefanie at gmail.com> wrote:
> 
> I tried that too, but it's still truncating at -4 and 6. So strange!
> >
> >
> >
> >On Sat, Jul 21, 2012 at 12:04 AM, arun <smartpink111 at yahoo.com> wrote:
> >
> >Hi,
> >>
> >>You can try this:
> >>
> >> x<-1:15
> >> y<--8:6
> >>  plot(x, y, type ="o", xlab="Panelist", ylab="T
> value",lwd=1.5,axes=FALSE)
> >>axis(1,at=c(0,2,4,6,8,10,12,14,16))
> >>axis(2,at=c(-8,-6,-4,-2,0,2,4,6,8))
> >>A.K.
> >>
> >>
> >>
> >>
> >>
> >>________________________________
> >>From: Stefanie Wind <wind.stefanie at gmail.com>
> >>To: arun <smartpink111 at yahoo.com>
> >>Sent: Friday, July 20, 2012 11:42 PM
> >>Subject: Re: [R] Control y axis
> >>
> >>
> >>
> >>Thanks! Do you know how I could get the values -8:8 to print on the y
> axis?
> >>
> >>
> >>On Fri, Jul 20, 2012 at 9:06 PM, arun <smartpink111 at yahoo.com> wrote:
> >>
> >>Hi,
> >>>
> >>>The bracket after lty=1 should be replaced with comma (,).
> >>> x<-1:15
> >>> y<--8:6
> >>> plot(x, y, type ="o", xlab="Panelist", ylab="T
> value",lwd=1.5,lty=1,xlim=range(1:14),ylim=range(-8:8),las=1)
> >>>
> >>>A.K.
> >>>
> >>>
> >>>
> >>>
> >>>----- Original Message -----
> >>>From: stefaniewind <wind.stefanie at gmail.com>
> >>>To: r-help at r-project.org
> >>>Cc:
> >>>Sent: Friday, July 20, 2012 3:29 PM
> >>>Subject: [R] Control y axis
> >>>
> >>>I can't get the y axis to extend the full range that I need, which
> is -8 to 8
> >>>
> >>>Here's my code. I tried using ylim, but it's still truncating at the
> >>>extremes in my data.
> >>>
> >>>plot(x, y, type ="o", xlab="Panelist", ylab="T value",lwd=1.5,lty=1)
> >>>xlim=range(1:14),ylim=range(-8:8), las=1)
> >>>
> >>>
> >>>Any suggestions?
> >>>
> >>>Thanks!
> >>>
> >>>
> >>>
> >>>--
> >>>View this message in context: http://r.789695.n4.nabble.com/Control-
> y-axis-tp4637266.html
> >>>Sent from the R help mailing list archive at Nabble.com.
> >>>
> >>>______________________________________________
> >>>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.
> >>>
> >>>
> >>
> >
> 
> ______________________________________________
> 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.



More information about the R-help mailing list