Skip to content
Prev 180492 / 398525 Next

replacing default axis labels on a plot - SOLUTION

The original problem posed was:
On 14/05/2009 7:31 AM, Graves, Gregory wrote:
and
Here is the solution to this:

# make a boxplot but suppress default labels on x axis with xaxt="n"

plot(flow~factor(month),xlab="Month",ylab="Total Flow per Month",
ylim=c(0,55000), xaxt="n")  #NOTE xaxt

# create a vector containing month abbrevs with [[1]] suffix as follows

month.name<-list(c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec"))[[1]]  

# place the 12 months on axis 1 (the x axis) as follows:
axis(1, at=1:12, labels=month.name)

Gregory A. Graves
Lead Scientist
REstoration COoordination and VERification (RECOVER) 
Watershed Division
South Florida Water Management District
Phones:  DESK: 561 / 682 - 2429 
             CELL:  561 / 719 - 8157