[R] Reverse axis in xyplot()

Arni Magnusson arnima at u.washington.edu
Fri Sep 19 00:22:45 CEST 2003


Thanks Roger, for pointing out the pretty() function. It's not
cross-referenced much in the documentation... Your example is not a
trellis one, but following the same approach:

xyplot(-y~x, scales=list(y=list(at=pretty(-y),
 labels=rev(format(pretty(y))))))

With the pretty() function this workaround does the job, and all the
braces look pretty as well :)

Arni




On Thu, 18 Sep 2003, Roger Koenker wrote:

> I had this question a while back in trying to do image plots of sparse
> matrices and ended up using this:
>
> 	image(x=1:p,y=-(n:1),t(z),axes=FALSE, col=col,xlab=xlab,ylab=ylab)
>         axis(1,pretty(1:p))
>         axis(2,pretty(-(n:1)),labels=rev(pretty(1:n)))
>
>
> Roger Koenker
>




More information about the R-help mailing list