# [R] Changing the Y graph scale Maximum value.

Jean Eid jeaneid at chass.utoronto.ca
Tue Oct 19 23:27:41 CEST 2004

```If I understand you correctl, you just want to call the point of (0,10) to
be (0,6). if so have a look at text() function text(0,10, pos=2) or
something like that will do. The reason why you are getting the error
because your 0:10 vector is larger than 0:6 vector.

Hope this helps,

P.S. why are you not doing plot(x,y, col="red", cex=1.5, ylim=c(0,6))
but maybe I do not understand what you need....

Jean.

On Tue, 19 Oct 2004, John Fisler wrote:

> Hello,
>
> I am new to R and have read the documents related to graphics but have
> not come across a description of how to change the maximum scale on a
> graph.  Below is sample code that sets up a plot window with a 0 Minimum
> to 10 Maximum, X and Y coordinate system:
>
> x <- c(1,2,3,4,5,6,7,8,9,10)
> y <- c(1,1.5,2,2.5,3,3.5,4,4.5,5,5.5)
> plot(0:10, 0:10, type = "n" )# setting up coord. system
> points(x, y, col = "red", cex = 1.5)
>
> I now want to change the maximum Y axis scale to 6.  I am using the
> 'points' function to plot 'x' and 'y' because my 'real' data is X and Y
> coordinate based.  When I try to change the maximum Y scale to 6 as in
> the following code segment, I get the following error:
>
> plot(0:10, 0:6, type = "n" )# setting up coord. system
> Error in xy.coords(x, y, xlabel, ylabel, log) :
>          x and y lengths differ
>
> How do I change the maximum Y scale to 6?
>
> Thanks,
>
> John Fisler
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help