log-spaced values with numpy

I knew this had to exist, since otherwise generated logarithmic plots in matplotlib would be a pain in the butt. Still, it took a bit of searching, although perhaps just the name should have clued me in.

 fig, ax = plt.subplots()
 steps = N.log10(N.logspace(0.9, 1-1e-5))
 ax.set_yscale('log', basex=10)
 ax.plot(steps, f(steps), '-')

Also, a shout-out for the ipython inline graphs (

ipython notebook --pylab inline

). Beautiful, and I can copy-paste them into emails and google docs!

Leave a Reply

Your email address will not be published. Required fields are marked *