diff options
author | Antoine Blais | 2024-04-10 12:19:59 +0200 |
---|---|---|
committer | Antoine Blais | 2024-04-10 12:19:59 +0200 |
commit | 2acf625a259ab47d34193e74e7ed1678d374b61b (patch) | |
tree | 405bd8481fe92914dc225cf36ac54aace252af6a | |
parent | 63eed8aed429d398022486d0279af0ba4624b8e7 (diff) | |
download | spectrum_analyser-2acf625a259ab47d34193e74e7ed1678d374b61b.zip spectrum_analyser-2acf625a259ab47d34193e74e7ed1678d374b61b.tar.gz spectrum_analyser-2acf625a259ab47d34193e74e7ed1678d374b61b.tar.bz2 spectrum_analyser-2acf625a259ab47d34193e74e7ed1678d374b61b.tar.xz |
-rw-r--r-- | simple_spectrum_analyser_scope.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/simple_spectrum_analyser_scope.py b/simple_spectrum_analyser_scope.py index 5f568ac..d257333 100644 --- a/simple_spectrum_analyser_scope.py +++ b/simple_spectrum_analyser_scope.py @@ -31,6 +31,7 @@ import zmq import matplotlib
import matplotlib.pyplot as plt
import matplotlib.backends.backend_agg as agg
+from matplotlib.ticker import FormatStrFormatter
# In order to integrate Matplotlib with Pygame, we need to use a
# non-interactive backend, otherwise Matplotlib will present us with a GUI
@@ -47,7 +48,7 @@ def plot_spectrum(x_1, x_2, data_1, data_2, i, i_last, ax, canvas): x_lim, y_lim = ax.get_xlim(), ax.get_ylim()
ax.clear()
ax.set_xlim(x_lim), ax.set_ylim(y_lim)
- ax.xaxis.set_major_formatter('{x:.3f}')
+ ax.xaxis.set_major_formatter(FormatStrFormatter('%.3f'))
ax.set_xlabel('MHz')
if in_dB is True:
ax.set_ylabel('Relative power (dB)')
|