我是R.的新手,一直试图绘制Klustakwik的神经尖峰特征(输出)。我调用函数spike.plot时得到的错误是:=>
plot.new()出错:数字边距太大
尝试较低的pch值,但无济于事。我想问题是数据点太多了。你能帮忙吗?
功能是:=>
spike.plot <- function(x, clust, col.scheme="rainbow", gr=1, pch=9, file=NULL, ...) {
#x: matrix with PCs or amplitudes
#clust: clustering vector (without first line when using KlustaKwik output)
#gr: feature groups (e.g. 4 if you are using 4 PCs per wire)
stopifnot(nrow(x)==length(clust))
#get min clust to 1
if(min(clust, na.rm=T)) clust <- clust - min(clust, na.rm=T) + 1
i <- which(clust==0)
if(length(i)) clust[i] <- NA
nclust <- length(unique(na.omit(clust)))
col <- 1:nclust
if(col.scheme=="rainbow")
col <- rainbow(nclust)[clust]
else if(col.scheme=="heat.colors")
col <- heat.colors(nclust)[clust]
else if(col.scheme=="terrain.colors")
col <-terrain.colors(nclust)[clust]
nas <- which(is.na(clust)==T)
if(length(nas)) {
clust[nas] <- nclust+1
col[nas] <- 200
}
if(length(gr)==1)
i <- seq(1, ncol(x), gr)
else if(length(gr)==ncol(x)) {
i <- c()
for(j in unique(gr)) i <- c(i, which(gr==j)[1])
}
else
stop("incompatible gr")
cbn <- combn(i,2)
n <- ncol(cbn)
nr <- ceiling(sqrt(n))
if(!is.null(file)) svg(file)
else X11() #plot in a new window
par(mfrow=c(n-nr,nr))
for(i in 1:ncol(cbn)) plot(x[,cbn[,i]], col=col, cex=.4, pch=pch, ...)
if(!is.null(file)) dev.off()
}
dim(x)= 7806 x 16 昏暗(clust)= 1 x 7806