Skip to content
Snippets Groups Projects

Only autoset ylim if not specified

Merged Sean Leavey requested to merge (removed):fix/ylim into master
1 unresolved thread
1 file
+ 2
1
Compare changes
  • Side-by-side
  • Inline
+ 2
1
@@ -40,7 +40,8 @@ def plot_noise(
alpha=0.6,
lw=4,
)
ylim = [min(data)/10, max(data)]
if ylim is None:
ylim = [min(data)/10, max(data)]
if 'label' not in style:
style['label'] = name
if 'linewidth' in style:
@@ -64,7+65,7 @@
ax.autoscale(enable=True, axis='y', tight=True)
if ylim:
ax.set_ylim(ylim)
    • @sean-leavey Is this not already handled down here? Wondering why this isn't working...

      • Author Contributor

        No because line 43 sets ylim even if it was None before. So line 66, if ylim:, is always True even if ylim is None during the method call.

        tbh, the logic here was already a bit confusing. Why is ylim, a variable that has apparently nothing to do with the 'Total' trace, being set in the if name == 'Total': block? Seems like a mistaken variable name or something...

      • Because the we wanted to set the default ylim based on the Total trace.

        I think your patch is the way to go. I'll merge.

      • Please register or sign in to reply
Please register or sign in to reply
ax.set_xlim(freq[0], freq[-1])
ax.set_xlabel('Frequency [Hz]')
Loading