Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, it's not very tidy to mix <code>pylab</code> and <code>pyplot</code> code. What's more, <a href="http://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related" rel="noreferrer">pyplot style is preferred over using pylab</a>.</p> <p>Here is a slightly cleaned up code, using only <code>pyplot</code> functions:</p> <pre><code>from matplotlib import pyplot a = [ pow(10,i) for i in range(10) ] pyplot.subplot(2,1,1) pyplot.plot(a, color='blue', lw=2) pyplot.yscale('log') pyplot.show() </code></pre> <p>The relevant function is <a href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yscale" rel="noreferrer"><code>pyplot.yscale()</code></a>. If you use the object-oriented version, replace it by the method <a href="http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yscale" rel="noreferrer"><code>Axes.set_yscale()</code></a>. Remember that you can also change the scale of X axis, using <a href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xscale" rel="noreferrer"><code>pyplot.xscale()</code></a> (or <a href="http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_xscale" rel="noreferrer"><code>Axes.set_xscale()</code></a>).</p> <p>Check my question <a href="https://stackoverflow.com/questions/3305865/what-is-the-difference-between-log-and-symlog">What is the difference between ‘log’ and ‘symlog’?</a> to see a few examples of the graph scales that matplotlib offers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload