Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions dspplot/dspplotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down