python - Blank screen in background - PyQt4 + matplotlib1.4.3 -
i'm running issue when trying call matplotlib figures pyqt gui. figures display fine, appear ugly blank grey screen behind both gui , figure. not go away until have closed gui.
here's section of gui in call function, in script, should display graph. post whole thing it's quite long.
def readsignal(self): signal = self.buttongroup.checkedid() #reads integer signal analysis options timestamps,deltapix,fps=motiontools.loaddata(self.filenames+"/") if signal == 1: motiontools.motioninroi(timestamps,deltapix) elif signal == 2: motiontools.bartimeinroi(deltapix) else: self.analysisoptionerror.show() both of these motiontools functions use data (timestamps , deltapix slices of arrays, fps frames-per-second integer) generate different graphs. here's example of 1 of them (bartimeinroi) - both cause grey screen error.
# bar graph of total time , pixels in each roi deltapix = deltapix[:,1:] # rid of background columns framerate = getframerate() rows,cols = deltapix.shape pixsums = np.sum(deltapix, axis=0) deltapix[deltapix>0]=1 # convert pixels time moving timesums = np.sum(deltapix, axis=0) / framerate f, (ax1, ax2) = plt.subplots(2, sharex=true) ax1.bar(np.arange(cols) + 1, pixsums, align='center') ax2.bar(np.arange(cols) + 1, timesums, align='center') plt.xlabel('roi number', fontsize=18) plt.xlim(0,cols+1) ax1.set_ylabel('locomotion \n(displaced pixels)', fontsize=18, va='center') ax1.yaxis.labelpad = 25 ax2.set_ylabel('locomotion \n(seconds motion)', fontsize=18, va='center') ax2.yaxis.labelpad = 25 f.set_facecolor('w') plt.tick_params(axis='both', which='major', labelsize=18) if cols < 21: plt.xticks(np.arange(1, cols+1, 1)) else: plt.xticks(np.arange(1, cols+1, 5)) plt.show() any ideas? have embed matplotlib graphs in interface?
Comments
Post a Comment