[R] replacing default axis labels on a plot
Uwe Ligges
ligges at statistik.tu-dortmund.de
Thu May 14 15:51:42 CEST 2009
Graves, Gregory wrote:
> Thanks. But ... Still don't get it.
>
> Referring explicitly to the monthname column which had many entries
> across many years did not work. So taking your clue I created a new
> variable list of names of month
>
> month.name<-list(c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
> "Aug", "Sep", "Oct", "Nov", "Dec"))
>
> then issued this command
>
> plot(flow~factor(month),xlab="Month",ylab="Total Flow per Month",
> ylim=c(0,55000), xaxt="n", axis(1, at=1:12, labels=month.name))
axis() is a separate function to be called *after* the call to plot().
Uwe Ligges
> which gave this error
>
> ERROR: 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
>
>
>
> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca]
> Sent: Thursday, May 14, 2009 8:12 AM
> To: Graves, Gregory
> Cc: r-help at r-project.org
> Subject: Re: [R] replacing default axis labels on a plot
>
> On 14/05/2009 7:31 AM, Graves, Gregory wrote:
>> I have 3 columns: flow, month, and monthname, where month is 1-12,
> and
>> monthname is name of month. I can't get the plot to replace the 1-12
>> with monthname using ticks.lab. What am I doing wrong?
>>
>> plot(flow~factor(month),xlab="Month",ylab="Total Flow per Month",
>> ylim=c(0,55000), ticks.lab="monthname")
>
> ticks.lab is not a parameter to the plot.formula function. You don't
> say where you found it described, but I'd suggest you read your source
> more closely, or just use xaxt="n" in the plot call, and construct your
> own call to axis(), e.g. axis(1, at=1:12, labels=monthname).
>
> Duncan Murdoch
>
>> Thanks
>>
>> 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
>>
>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list