[R] Plotting with R: setting the y axis

Dylan Beaudette dylan.beaudette at gmail.com
Mon Nov 26 20:37:57 CET 2007


On Monday 26 November 2007, Dave Jacoby wrote:
> I have a series of numbers I'm wanting to plot. They come from a
> nanodrop machine, which graphs with a specific x and y indices. X goes
> from 220nm to 350nm, which I can set. But the y axis should go from -5
> to 65, but I'm finding it impossible to hardcode that.
>
> I've looked. I've typed ?plot at the R prompt. Google has not been my
> friend. _R Graphics_, if it holds the key, has not presented it to me.
> Can anyone help?
>
> > x <- (220:350)
> > z <- c(21.56 , 21.12 , 20.44 , 19.83 , 19.35 , 18.53 , 18.01 , 17.78 ,
> > 17.51 , 17.34 , 17.26 , 17.18 , 17.18 , 17.23 , 17.36 , 17.65 , 17.95 ,
> > 18.57 , 19.42 , 20.14 , 21.22 , 22.1 , 22.64 , 23.56 , 24.66 , 25.32 ,
> > 26.2 , 27.02 , 27.61 , 28.45 , 29.15 , 29.57 , 30.34 , 31.2 , 31.67 ,
> > 32.25 , 32.64 , 32.8 , 32.88 , 32.87 , 32.8 , 32.61 , 32.32 , 32.05 ,
> > 31.49 , 30.7 , 29.76 , 29.13 , 28.1 , 27.06 , 26.44 , 25.51 , 24.56 ,
> > 23.9 , 22.88 , 21.86 , 21.15 , 19.96 , 18.72 , 17.89 , 16.73 , 15.64 ,
> > 14.53 , 13.8 , 12.8 , 11.9 , 11.32 , 10.4 , 9.49 , 8.95 , 8.19 , 7.41 ,
> > 6.63 , 6.15 , 5.48 , 4.88 , 4.53 , 4.06 , 3.67 , 3.43 , 3.09 , 2.81 ,
> > 2.53 , 2.36 , 2.15 , 1.97 , 1.86 , 1.71 , 1.6 , 1.5 , 1.45 , 1.4 , 1.34 ,
> > 1.31 , 1.28 , 1.25 , 1.23 , 1.21 , 1.18 , 1.14 , 1.12 , 1.09 , 1.06 ,
> > 1.02 , 1.01 , 1 , 0.98 , 0.97 , 0.96 , 0.95 , 0.94 , 0.94 , 0.93 , 0.92 ,
> > 0.92 , 0.9 , 0.89 , 0.88 , 0.87 , 0.84 , 0.82 , 0.81 , 0.8 , 0.79 , 0.78
> > , 0.77 , 0.76 , 0.76 , 0.75 , 0.73 , 0.71 )
> > jpeg("nano_WoloshukRIB401488.jpg")
> > plot( x ,
> >       z ,
> >       type="l" ,
> >       cols="red" ,
> >       main="nanodrop - #012345" ,
> >       xlab="Wavelength(nm)" ,
> >       ylab="10mm Absorbance" )
> > dev.off()

see the arguments xlim and ylim in plot.default



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-help mailing list