title: How to get an x-axis adapted to audio/acoustics with pyplot?
body: <p>When plotting frequency response curves:</p>
  
  <pre><code>import numpy as np
  from scipy import signal
  import matplotlib.pyplot as plt
  w, h = signal.freqz([1, -1])
  x = w * 44100 * 1.0 / (2 * np.pi)
  y = 20 * np.log10(abs(h))
  </code></pre>
  
  <p>then <code>plt.plot(x, y)</code> and <code>plt.semilogx(x, y)</code> give:</p>
  
  <p><img src="https://i.stack.imgur.com/XvyMv.png" width="200">
  <img src="https://i.stack.imgur.com/AVfZn.png" width="200"></p>
  
  <p>but none of them have the "standard x-axis used in audio".</p>
  
  <p><strong>Question: how to have the x-axis usually used in audio applications?</strong> It includes:</p>
  
  <ul>
  <li>some sort of logarithmic axis, but not sure: is it really a normal logarithmic axis (see examples after)?</li>
  <li>axis from 20 to 20Khz, and ticks <code>["20", "50", "100", "200", "500", "1K", "2K", "5K", "10K", "20K"]</code></li>
  </ul>
  
  <p>Here are a few examples of what I mean:</p>
  
  <p><a href="https://i.stack.imgur.com/Vr6wi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vr6wi.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/PDYWw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PDYWw.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/OMRzr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OMRzr.jpg" alt="enter image description here"></a></p>