Description Usage Arguments Value Author(s) References See Also Examples
View source: R/rotate180.matrix.R
Rotate a matrix by 180 degrees. Used for adjusting image plotting in R.
1 |
x |
A matrix corresponding to raster or image data. |
Returns a matrix
Glenn J Tattersall
1. http://www.inside-r.org/packages/cran/RSEIS/docs/mirror.matrix
2. Based on similar code in package <RSEIS>
flip.matrix
mirror.matrix
rotate90.matrix
rotate270.matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## The function is currently defined as
function (x)
{
xx <- rev(x)
dim(xx) <- dim(x)
xx
}
# set.seed(5)
# par(mfrow=c(1,2),mar=c(1,1,1,1))
# r<-c(1:100,rnorm(1:100)*10,1:100)
# m<-matrix(r,50)
# image(m, axes=FALSE)
# box()
# text(.5,.5,"Matrix")
# mf<-rotate180.matrix(m)
# image(mf,axes=FALSE)
# box()
# text(.5,.5,"Rotate180",col="white")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.