I am writing a code to fit a gaussian over a function and if I don't plot the result (it is a datacube of ~60x60 spectra, so I am using a loop) the code works really fast.
But when I say the code to plot every graph it gets really slow, something like 2 graphs a second (when I don't plot it does like 40).
Ok, I understand it can be right to slow a lot down, but there is a code in IDL that does the exact same thing and the code runs 8~10 plots per second.
Is there a way to improve it? Or python is really slower than IDL?
Here is the plot code:
plt.plot(wavelengthset, data_datacube[minpixel:maxpixel+1, j, i], 'k-',
wavelengthset, gaussian(fit[0], wavelengthset), 'r-')
plt.draw()
plt.clf()