R/plot_default_plot_fun.R

Defines functions default.plot.fun

# the default plot fun is used if no other plot method is defined for a stmulus type. 
# shows cursors using their own methods and shows a zero line
# uses zoom from cursor and has pre-set ylab and xlab
default.plot.fun<-function(sweeps_data,cursors,
                           sweeps=1:ncol(sweeps_data$y),
                           xlim=sweeps_data$cursors$zoom, 
                           ylab="current [nA]", 
                           xlab="seconds",
                           bty="l",
                           col.zeroline="grey80",
                           ...){
	#str(sweeps_data$x)
	plot(rbind(as.matrix(sweeps_data$x[,sweeps]), NA),rbind(as.matrix(sweeps_data$y[,sweeps]), NA),type="l" ,
	     xlim=xlim, ylab=ylab, xlab=xlab,bty=bty,

			 panel.first={
			 	for ( cursor in cursors) {
			 		if (!is.null(cursor$plot.fun.first)){
			 			cursor$plot.fun.first(cursor, sweeps_data=sweeps_data)
			 		}
			 	}
			 	#grid()
			 	abline(h=0,col=col.zeroline, lty=3)
			 },
			 panel.last={
			 	for ( cursor in cursors) {
			 		if (!is.null(cursor$plot.fun.last)){
			 			cursor$plot.fun.last(cursor, sweeps_data$result,sweeps)
			 		}
			 	}
			 },
			 ...
	)
}
tdanker/ephys2 documentation built on Aug. 11, 2019, 12:12 p.m.