[R] plot custom x axis ticks values

Jim Lemon jim at bitwrit.com.au
Fri Feb 15 10:51:48 CET 2013


On 02/15/2013 07:28 PM, e-letter wrote:
> ...
> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n',xlim=c(0,300))
> axis(1,at=c(0,100,200,300))
>
> The use of 'xlim' makes the graph unacceptable. Instead, it would be
> better to plot:
>
> plot(testvalues,ann=FALSE,type='l',yaxt='n')
>
> The x-axis shows tick marks '1.0', '1.5', ...
>
> It is required to replace these values with custom values (e.g. 10, 20... etc.)

Okay, I think I see what you want:

plot(testvalues,ann=FALSE,type='l',yaxt='n')
axis(2,at=c(1,1.5,2,2.5,3),labels=c(10,20,30,40,50))

Jim



More information about the R-help mailing list