R/plot.noia.marloc.R

Defines functions plot.noia.marloc

Documented in plot.noia.marloc

plot.noia.marloc <- 
function(x, xlab=NULL, ylim=NULL, ylab=attr(x, "what"), ...) 
{
	frq <- function(lab) as.numeric(strsplit(lab, split="|", fixed=TRUE)[[1]][2])
	allele <- function(lab) strsplit(lab, split="|", fixed=TRUE)[[1]][1]
	if (length(dim(x)) > 1) {
		stop("Impossible to plot an array. For two dimensions, try image.")
	}
	
	if(is.null(xlab)) xlab <- allele(names(x)[1])
	if(is.null(ylim)) {
		ylim <- range(x)
		if (attr(x, "what") %in% c("varA","varG")) 
			ylim[1] <- 0
	}
	plot(x=sapply(rownames(x), frq), y=x, xlab=xlab, ylim=ylim, ylab=ylab, type="l", ...)
}

Try the noia package in your browser

Any scripts or data that you put into this service are public.

noia documentation built on March 31, 2023, 6:45 p.m.