tau
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tau [2008/01/28 11:40] – created heidi | tau [2008/07/22 13:31] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | * file: lines_Mismatch.r | + | * file: matrix_tau.r |
- | * document page: 1 | + | * document page: 31 |
\\ | \\ | ||
**code:** | **code:** | ||
< | < | ||
+ | #----read data------------------------------------------------------------------ | ||
+ | Data <- read.table(" | ||
+ | Columns <- ncol(Data)+1 | ||
+ | Row <- nrow(Data) | ||
+ | |||
+ | x <- 6 | ||
+ | n <- 2 | ||
+ | |||
+ | #----read data line by line----------------------------------------------------- | ||
+ | tauMatrix <- as.matrix(scan(" | ||
+ | | ||
+ | tauMatrix <- cbind(t(tauMatrix), | ||
+ | tauMatrix <- tauMatrix[, | ||
+ | |||
+ | n <- n + 1 | ||
+ | x <- x + 1 | ||
+ | |||
+ | while(n< | ||
+ | nextrow <- as.matrix(scan(" | ||
+ | | ||
+ | nextrow <- cbind(t(nextrow), | ||
+ | nextrow <- nextrow[, | ||
+ | |||
+ | tauMatrix <- rbind(tauMatrix, | ||
+ | |||
+ | n <- n + 1 | ||
+ | x <- x + 1 | ||
+ | } | ||
+ | |||
+ | a <- ncol(tauMatrix) | ||
+ | b <- nrow(tauMatrix) | ||
+ | |||
+ | x <- c(1:a) | ||
+ | y <- c(1:b) | ||
+ | |||
+ | #----draw plot------------------------------------------------------------------ | ||
+ | library(fields) | ||
+ | ColorRamp <- rgb( seq(1, | ||
+ | seq(1, | ||
+ | seq(1, | ||
+ | |||
+ | #----Mirror matrix (left-right)---- | ||
+ | mirror.matrix <- function(x) { | ||
+ | xx <- as.data.frame(x); | ||
+ | xx <- rev(xx); | ||
+ | xx <- as.matrix(xx); | ||
+ | xx; | ||
+ | } | ||
+ | |||
+ | #----Rotate matrix 270 clockworks---- | ||
+ | rotate270.matrix <- function(x) { | ||
+ | mirror.matrix(t(x)) | ||
+ | } | ||
+ | |||
+ | tauMatrix <- rotate270.matrix(tauMatrix) | ||
+ | |||
+ | #----draw matrix plot---- | ||
+ | image.plot(x, | ||
+ | population sizes (tau)", | ||
+ | legend.args=list( text=" | ||
+ | | ||
+ | | ||
+ | | ||
+ | box() | ||
+ | </ |
tau.1201516828.txt.gz · Last modified: 2008/07/22 13:30 (external edit)