June 2016
Beginner to intermediate
1783 pages
71h 22m
English
In this recipe, we will learn how to add and customize grid lines to graphs.
We will use the base graphics for this recipe, so all you need to do is run the recipe at the R prompt. It is good practice to save your code as a script for use again later.
Let's use the city rainfall example again to see how we can add grid lines to that graph:
rain<-read.csv("cityrain.csv")
plot(rain$Tokyo,type="b",lwd=2,
xaxt="n",ylim=c(0,300),col="black",
xlab="Month",ylab="Rainfall (mm)",
main="Monthly Rainfall in Tokyo")
axis(1,at=1:length(rain$Month),labels=rain$Month)
grid()
It's ...
Read now
Unlock full access