当前正在使用Python 3.6.0 | Continuum Analytics,Inc. | (默认,2016年12月23日,11:57:41)在Windows(64位)上。如何为后续matplotlib图创建新窗口?
我想要一个我写的程序来生成两个不同的图。一个情节将有三个单独的图,然后我想要一个单独的窗口,显示一个直方图。
plt.subplot(311)
plt.plot(z)
plt.xlabel('Time(s)', fontsize=14)
plt.ylabel('Amplitude(v)', fontsize=8)
fig.subplots_adjust(hspace=.5)
plt.figure
plt.subplot(312)
plt.plot(timey[0:(len(freq))//2],y)
plt.xlabel('Frequency(Hz)', fontsize=14)
plt.ylabel('Amplitude(V)', fontsize=8)
plt.subplot(313)
plt.plot(fre, psd)
plt.xlabel('Frequency(Hz)', fontsize=14)
plt.ylabel('Power Spectrum Density(Watts/Hz)', fontsize =8)
plt.show()
np.savetxt(file ,y, delimiter=' ',newline=' ')
plt.savefig('FFT'+i+'.png', bbox_inches='tight')
wait = input("PRESS ENTER TO CONTINUE.") #an attempt at breakpoints
plt.figure
plt.subplot(111)
plt.plot(bin[0:bnn],his)
plt.show()
plt.savefig('Histogram'+i+'.png', bbox_inches='tight')
即使使用plt.figure()
,我还是积凌驾现有的图解,除非我用plt.subplot(111)
,这将抹掉原来的情节,并将在同一窗口中新建一个。我希望生成两个独立的窗口。我已经阅读了几个以前的问题无济于事。我试过使用%matplotlib qt
或者我已经输入mpl作为,但也没用。也许我不明白这个的语法?
确定要调用'plt.figure()(括号)吗? – TomDLT