[R] User defined axis on image plots
joerg.maeder at ethz.ch
Fri Nov 2 09:09:51 CET 2001
for my example i used the following datas
z <- matrix(runif(20),5,4) #random datas
x <- c(1:nrow(z)); y <- (1:ncol(z))
xs <- letters[1:nrow(z)] # for the text labels
image(x,y,z,xaxt='n') # with xaxt='n' R doesn't write the x-axis
# now you can do it manually
# par()$usr gives the lowest y-value
# xpd=T allows printing ouside the inner region of the image
# srt=90 string rotation
# adj=2 the strings are adjusted at the rigth side and have a small
space to the defined place
# adj=1 wouold adjust rigth without space, adj=.05 center adj=0 left
and so on
# you can do the same thing with the y-axis (yaxt='n', par()$usr but
tip: have a look to the help of par, there are many useful things.
Mark Scarr wrote:
> Hi All,
> As a newbie to R I have the following question, which I couldn't
> find an answer to in the documentation.
> I have an x, y, z image plot of some data, where x and y are vectors
> of the form x = c(1:nrow(z)), y = (1:ncol(z)). As a result this places
> integer values on the X-axis, whereas they are in fact dates. I have
> another string vector of dates which I would like to use on the X-axis
> instead, suitably spaced and preferably vertical (rather than horizontal).
> Any help would be most appreciated,
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
Joerg Maeder IACETH INSTITUTE
PhD Student FOR ATMOSPHERIC
Phone: +41 1 633 36 25 AND CLIMATE SCIENCE
Fax: +41 1 633 10 58 ETH ZÜRICH Switzerland
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help