[R] axes labeling
David L Carlson
dcarlson at tamu.edu
Thu Dec 20 20:58:00 CET 2012
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)
# or axis(2, pos, lbl, las=2) to rotate the y tick mark labels.
----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Sam Steingold
> Sent: Thursday, December 20, 2012 1:22 PM
> To: r-help at r-project.org
> Subject: [R] axes labeling
>
> Is it possible to control formatting of the numbers which go along the
> axes in plots?
> e.g.
> plot(x=1:1000000,y=1:1000000)
> will label the X axis as "0d+00", "2e+05" &c.
> I want that to read 0, 200k, 400k &c.
> I know of the function axis(), but it offers far too much control for
> this simple task.
> thanks.
> --
> Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X
> 11.0.11103000
> http://www.childpsy.net/ http://www.memritv.org http://jihadwatch.org
> http://pmw.org.il http://americancensorship.org http://think-israel.org
> Why do we want intelligent terminals when there are so many stupid
> users?
>
> ______________________________________________
> 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