[R] Formatting the axis of plot() to shown our own values.

Stephan Kolassa Stephan.Kolassa at gmx.de
Sun Jan 18 20:35:40 CET 2009


Hi Saurabh

saurabh_koparkar schrieb:
> Part 1: 
> I want to plot the CO2 concentration vs. year, but extending the x-axis
> using the xlim parameter to include the year 2006 (x axis range of values
> are from -41210 to 0), and adjusting the ylim parameter to go up to 400 when
> the range of y axis values are from 150 to 300. How do I do this? Using axis
> function? I am confused about the syntax here. 

plot(year,co2,xlim=c(-41210,2006),ylim=c(150,400))

> Part 2:
> I also want to use the points() function to add the data points from years
> 1958-2006 on X axis to the above plot, but in a different color. 

points(...,...,bg="red")

Perhaps also col="red" - may depend on what character (pch=..) you are 
plotting.

HTH,
Stephan




More information about the R-help mailing list