Logarithmic slider with matplotlib
<p>I just implemented a slider in my plot which works great. (I used this example: <a href="http://matplotlib.org/examples/widgets/slider_demo.html" rel="nofollow">http://matplotlib.org/examples/widgets/slider_demo.html</a>) Now my question is if it is possible to make the slider logarithmic. My values range between 0 and 1 and I want to make changes from 0.01 to 0.02 and so on but also from 0.01 to 0.5. That is why I think a logarithmic scale would be nice. Also if this isn't doable with a slider do you then have other ideas how to implement this? </p>

<p>You can simply <code>np.log()</code> the value of the slider. However then the label next to it would be incorrect. You need to manually set the text of <code>valtext</code> of the slider to the log-value:</p>

<pre><code>def update(val):
    amp = np.log(slider.val)
    slider.valtext.set_text(amp)
</code></pre>

python matplotlib