[R] axes labeling

Sam Steingold sds at gnu.org
Thu Dec 20 21:12:17 CET 2012


> * David L Carlson <qpneyfba at gnzh.rqh> [2012-12-20 13:58:00 -0600]:
>
> It is possible, but only by using axis() since you can specify axis breaks
> in a plot command, but not the labels. You can ignore most of the axis()
> options so the commands are pretty simple:
>
> plot(x=c(1, 1000000), y=c(1, 1000000), xlab="x", ylab="y", 
>      xaxt="n", yaxt="n", las=2)
> pos <- c(0, 200000, 400000, 600000, 800000, 1000000)
> lbl <- c("0", "200k", "400k", "600k", "800k", "1000k")
> axis(1, pos, lbl)
> axis(2, pos, lbl)

That's what I meant when I said "too much control".
I am happy with the way R selects positions.
All I want is a say in the way R formats those positions.

Think in terms of 1000000 being a variable.
To use axis, I will need to write a map from variable range to axis tick
positions first, and then sapply my formatting to the positions.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://think-israel.org http://iris.org.il
http://mideasttruth.com http://www.memritv.org http://memri.org
All extremists should be taken out and shot.




More information about the R-help mailing list