From 85f99e73622e1be65de0563ee1d44b811441290a Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 28 Oct 2020 19:16:51 +0100 Subject: [PATCH] matplotlib moved to local import --- micmon/audio/segment.py | 5 +++-- requirements.txt | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/micmon/audio/segment.py b/micmon/audio/segment.py index 83150b5..d7d634a 100644 --- a/micmon/audio/segment.py +++ b/micmon/audio/segment.py @@ -1,7 +1,6 @@ -from typing import Optional, Union +from typing import Optional import numpy as np -import matplotlib.pyplot as plt class AudioSegment: @@ -30,11 +29,13 @@ class AudioSegment: ]) def plot_audio(self): + import matplotlib.pyplot as plt plt.plot(self.audio) plt.show() def plot_spectrum(self, low_freq: int = default_low_freq, high_freq: int = default_high_freq, bins: int = default_bins): + import matplotlib.pyplot as plt spectrum = self.spectrum(low_freq=low_freq, high_freq=high_freq, bins=bins) plt.ylim(0, 1) plt.bar(range(len(spectrum)), spectrum) diff --git a/requirements.txt b/requirements.txt index 5dd0324..5816112 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ numpy tensorflow keras +matplotlib