def array(segments, sensors=None, plotAllSubjects=False, plotCbar=True, test='nonparametric', p=.05, **kwargs): """ NOT MAINTAINED plots tv plots to a rectangular grid instead of topographic spacing kwargs: sensors: List of sensor IDs test='nonparametric', None if len(segments) > 2 """ P.clf() # prepare args segments = _basic_ops_.toTuple(segments) kwargs['test']=test if sensors==None: sensors = range(len(segments[0].sensors)) else: sensors = _basic_ops_.toTuple(sensors) statsColorspace = _cs.get_sig(p) # determine plotting grid nPlots = len(sensors) * (1+plotAllSubjects) + plotCbar nColumnsEst = np.sqrt( nPlots ) nColumns = int(nColumnsEst) if nColumns != nColumnsEst: nColumns += 1 if nColumns % (1+plotAllSubjects) != 0: nColumns += 1 nRows = int( nPlots / nColumns ) + (1- ( nPlots % nColumns == 0 )) logging.debug("plotting electrodes %s, fig shape (%s, %s)"%(str(sensors), nRows, nColumns)) # fig = P.gcf() P.subplots_adjust(left=.05, bottom=.075, right=.99, top=.94, wspace=.25, hspace=.3) #grid = AxesGrid( fig, 111, # nrows_ncols = (nRows, nColumns), # axes_pad = .01 ) # plot kwargs['labelNames']=True for i,sensor in enumerate(sensors): kwargs['lastRow'] = ( i > (nRows-1) * nColumns) if plotAllSubjects: #axes = grid[ (i+1)*2 ] # axes = P.subplot(nRows, nColumns, (i+1) * 2 -1 ) kwargs["plotType"]='mean' _ax_utsStats(segments, sensor, statsColorspace=statsColorspace, **kwargs) axes.set_title( segments[0].sensors[sensor].name ) #axes = grid[ (i+1)*2+1 ] # axes = P.subplot(nRows, nColumns, (i+1) * (1+plotAllSubjects) ) kwargs["plotType"]='all' _ax_utsStats(segments, sensor, statsColorspace=statsColorspace, **kwargs) axes.set_title( ', '.join(( segments[0].sensors[sensor].name, "All Subjects")) ) else: #axes = grid[i] # axes = P.subplot(nRows, nColumns, (i+1) ) kwargs["plotType"]='mean' _ax_utsStats(segments, sensor, statsColorspace=statsColorspace, firstColumn=( i%nColumns==0 ), **kwargs) axes.set_title( segments[0].sensors[sensor].name ) kwargs['labelNames']=False if test!=None and plotCbar: #axes = grid[-1] # axes = P.subplot(nRows, nColumns, nRows*nColumns) pos = axes.get_position() newPos = [pos.xmin, pos.ymin+pos.width*.3, pos.width, pos.width*.15] axes.set_position(newPos) statsColorspace.toAxes_(axes)
def defaultColorspace(self, p=.05, **kwargs): #print "segment.defaultColorspace", kwargs if self.dir==None: return _cs.get_sig(p, **kwargs) else: return _cs.get_symsig(p, **kwargs)