title: How do I change the format of the axis label in matplotlib
body: <p>If I plot a log scale graph, matplotlib gives me the nice looking entries 10<sup>5</sup>, 10<sup>6</sup>, ...</p>
  
  <p>For readability I would however prefer the form 1e5, 1e6, ...</p>
  
  <p>Can I directly set the axis properties to behave that way?</p>
  
  <p>I rather ugly hack would be:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  x = np.linspace(1, 40, 100);
  y = np.linspace(1, 5, 100);
  
  # Actually plot the exponential values
  plt.plot(x, 10**y)
  ax = plt.gca()
  ax.set_yscale('log')
  
  # Rewrite the y labels
  y_labels = ax.get_yticks()
  ax.set_yticklabels(['1e%i' % np.round(np.log(y)/np.log(10)) for y in y_labels])
  
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/cjfik.png" alt="enter image description here"></p>
  
  <p>But surely there must be a better way.</p>