[R] Grid lines

Thomas Roth (geb. Kaliwe) hamstersquats at web.de
Thu Jul 30 10:17:00 CEST 2009


Maybe this helps


par(mar = c(5,4,6,1))
plot(1:10, type = "n", axes = F)
xticks = axis(1, at = c(1,5,9), labels = 
c("1-1-2009","1-5-2009","1-9-2009"))   #set axis manually
yticks = axis(2, at = 1:10)   #set axis manually
abline(v = xticks, col = "gray")   #verticall lines
abline(h = yticks, col = "gray", lty = 3)   #horizontal lines

legend(8,12, legend = c("test", "test"), col = 1:2, pch = 1:2, xpd = TRUE)

points(1:10)


Thomas Roth

Chris Li schrieb:
> Hi everyone. I am new to R.
>
> It will be greatly appreciated if someone can help me with the following
> questions.
>
> Here's the graph I have just produced. 
> http://www.nabble.com/file/p24732839/calibration.jpeg 
>
> (1) How can I put the legend on top of the grid lines?
>
> (2) How can I match the grid lines with the x-axis ticks?
>
> (3) How can I change the x-axis format from e.g. Mar, Apr...etc to
> 1-3-2009,1-4-2009...etc?
>
> Many thanks! :-)
>
> Chris
>




More information about the R-help mailing list