[R] Plot with different x axis

Greg Snow
2009-06-02T19:23:48Z

Try:

xpts <- 2^(0:4)

x <- 2^runif(100, 0,4)
y <- rnorm(100)

plot( log(x, base=2), y, xlab='x', xaxt='n' )
axis(1, at=log(xpts, base=2), lab=xpts)

plot(x,y) # for comparison


see ?par and ?axis for details

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Irina Foss
> Sent: Tuesday, June 02, 2009 1:14 PM
> To: r-help at R-project; r-help at r-project.org; r-help at r-project.org
> Subject: [R] Plot with different x axis
>
> dear,
>
> I am trying to plot a standard plot, but I want the x axis to be
> 1,2,4,8,16 with equal intervals between them on plot.
>
> I will appreciate some help.
>
> Thank you,
>
> Irina
>
>
>
> Irina Foss
> Environmental Research Institute
> North Highland College
> UHI Millennium Institute
> Castle Street
> Thurso, Caithness
> Scotland
> KW14 7JD
> United Kingdom
>
> Tel:  +44 (0) 1847 889 587
> Fax: +44 (0) 1847 890 014
> http://www.eri.ac.uk/sub/staff.php?id=11
>
> ______________________________________________
> 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.