[R] how to ajust y-axis values in plot() ?

S Ellison S.Ellison at LGCGroup.com
Tue Oct 14 13:48:59 CEST 2014



>   I want to plot( 11:20 ) in a plot.
>  if i just type the code above, the y value  will be from 11 to 20, now i want the
> value from a given range like  0 to 40, how can i do it?
See the ylim= argument to plot.default; eg
plot(x, y, ylim=c(0,40))

Also look at ?par and note that plot() and other things often take many of par's arguments.


> Actually, the qustion is founded when i already plot a plot like plot(11:20) , but
> when i abline(h=40), i found it will go out of the plot even after i used
> abline(h=40,xpd=T).
Um, yes. A horizontal line at y=40 would not even be inside the plot window if the plot region is scaled to c(11,20). Where did you expect/want the line to appear? 

S


*******************************************************************
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmaster at lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK


More information about the R-help mailing list