my code
import matplotlib.pyplot plt plt.style.use("ggplot") import numpy np mtspec import mtspec mtspec.util import _load_mtdata data = np.loadtxt('262_v01_c00_r000_tex_bl_4096h.dat') spec,freq,jackknife,f_statistics,degrees_of_f = mtspec(data=data, delta= 4930.0, time_bandwidth=4 ,number_of_tapers=5, nfft= 4194304, statistics=true) fig = plt.figure() ax2 = fig ax2.plot(freq, spec, color='black') ax2.fill_between(freq, jackknife[:, 0], jackknife[:, 1],color="red", alpha=0.3) ax2.set_xlim(freq[0], freq[-1]) ax2.set_ylim(0.1e1, 1e5) ax2.set_xlabel("frequency $") ax2.set_ylabel("power spectral density $)") plt.tight_layout() plt.show()
the problem plotting part of code.what should change?i using python 2.7 on ubuntu.
you assign ax2
figure
object doesn't have plot
method defined. want create axes using plt.axes
instead
ax2 = plt.axes() # instead of ax2 = fig
Comments
Post a Comment