Skip to content

Commit

Permalink
space for png
Browse files Browse the repository at this point in the history
  • Loading branch information
e-dub committed Dec 23, 2021
1 parent 153b0a8 commit 8da7e9c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pyAudioAnalyzer/AudioAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def PlotTimeDomainList(self, tMin=0.0, tMax=[], alpha=1, title=False, saveas=Fal
)
plt.legend(frameon=False, loc='center left', bbox_to_anchor=(1, 0.5))
sns.despine()
plt.tight_layout()
if title:
plt.title(title)
if saveas:
Expand All @@ -170,11 +171,12 @@ def PlotTimeDomain(
plt.ylim(-ymax, ymax)
plt.xlim([tMin, tMax])
sns.despine()
plt.tight_layout()
if saveas:
plt.savefig(saveas)
plt.show()

def _PlotDecibel(self, tMin=0.0, tMax=[], label=[], single=True, alpha=1):
def _PlotDecibel(self, tMin=0.0, tMax=[], label=[], single=True, alpha=1, saveas=False):
"""
not working!
self.dB = 20 * np.log10(abs(val) / ref)
Expand All @@ -193,6 +195,7 @@ def _PlotDecibel(self, tMin=0.0, tMax=[], label=[], single=True, alpha=1):
)
plt.xlabel('time [s]')
plt.ylabel('sound pressure level $L_p$ [dB]')
plt.tight_layout()
if saveas:
plt.savefig(saveas)
plt.show()
Expand All @@ -218,6 +221,7 @@ def PlotFFTList(self, fMin=0.0, fMax=[], alpha=1, title=False, saveas=False):
plt.xlim(fMin, fMax)
plt.legend(frameon=False, loc='center left', bbox_to_anchor=(1, 0.5))
sns.despine()
plt.tight_layout()
if title:
plt.title(title)
if saveas:
Expand Down Expand Up @@ -247,6 +251,7 @@ def PlotFFT(self, fMin=0, fMax=[], label=[], single=True, alpha=1, title=False,
sns.despine()
plt.xlim([fMin, fMax])
plt.ylim(0, np.max(XVal)*1.1)
plt.tight_layout()
if saveas:
plt.savefig(saveas)
plt.show()
Expand All @@ -267,6 +272,7 @@ def PlotPower(self, fMax=[], title=False, saveas=False):
plt.title(title)
# plt.title('Log spectrum in frequency domain')
sns.despine()
plt.tight_layout()
if saveas:
plt.savefig(saveas)
plt.show()
Expand Down Expand Up @@ -302,6 +308,7 @@ def PlotFFT2TimeDomain(self, title=False, saveas=False):
plt.xlabel('time $t$ [s]')
# plt.title('From frequency domain back into time domain')
sns.despine()
plt.tight_layout()
if title:
plt.title(title)
if saveas:
Expand All @@ -323,6 +330,7 @@ def PlotCepstrum(self, tMax=[], title=False, saveas=False):
# plt.title('Cepstrum')
plt.xlim([0, tMax * 100])
sns.despine()
plt.tight_layout()
if title:
plt.title(title)
if saveas:
Expand Down Expand Up @@ -356,6 +364,7 @@ def PlotFFTpyFFTW(self, nthreads=2, fMin=0, fMax=[], title=False, saveas=False):
# plt.title('Frequency domain (calculated with pyFFTW)')
plt.xlim([fMin, fMax])
sns.despine()
plt.tight_layout()
if title:
plt.title(title)
if saveas:
Expand Down

0 comments on commit 8da7e9c

Please sign in to comment.