From bdc630e8867d571355bffbcb6e55d7a07340def8 Mon Sep 17 00:00:00 2001 From: KoenVda88 <66839640+KoenVda88@users.noreply.github.com> Date: Sat, 5 Mar 2022 21:24:54 +0100 Subject: [PATCH] Update dspplotting.py Fix gen_tick functions --- dspplot/dspplotting.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dspplot/dspplotting.py b/dspplot/dspplotting.py index 8e099d1..6474fd3 100644 --- a/dspplot/dspplotting.py +++ b/dspplot/dspplotting.py @@ -12,23 +12,25 @@ def gen_ticks(stop, start=10): yield start - for s in range(0, 10): + for s in range(2, 10): if start * s > stop: yield stop - raise StopIteration + break yield start * s - for t in gen_ticks(stop, start * 10): - yield t + else: + for t in gen_ticks(stop, start * 10): + yield t def gen_tick_labels(stop, start=10): yield (str(start) + 'Hz').replace('000Hz', 'kHz') - for s in range(0, 10): + for s in range(2, 10): if start * s > stop: yield (str(int(stop)) + 'Hz').replace('000Hz', 'kHz') - raise StopIteration + break yield '' - for t in gen_tick_labels(stop, start * 10): - yield t + else: + for t in gen_tick_labels(stop, start * 10): + yield t def smooth_colormap(colors, name='cmap1'): to_rgb = clr.ColorConverter().to_rgb