[R] plot custom x axis ticks values

MacQueen, Don macqueen1 at llnl.gov
Thu Feb 14 19:53:06 CET 2013


> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
> par()$usr
[1]  0.88  4.12  8.80 41.20

The x axis range is from 0.88 to 4.12, so tick labels at 0, 100, 200, 300
makes no sense.

Any axis() command where the 'at' values are within the range of the x
axis will work. Even, for example,

  axis(1, at=c(2.5, 3.7) )

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 2/14/13 2:41 AM, "e-letter" <inpost at gmail.com> wrote:

>Readers,
>
>For this data set:
>
>testvalues<-c(10,20,30,40)
>
>How to amend the plot instruction:
>
>plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
>
>so that x axis ticks labels can be added to existing graph with
>arbitrary value such as 0,100,200,300)?
>
>Thanks in advance.
>
>--
>r2151
>
>______________________________________________
>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