Plotting with scientific axis, changing the number of significant figures
<p>I am making the following plot in matplotlib, using amongst other things <code>plt.ticklabel_format(axis='y',style='sci',scilimits=(0,3))</code>. This yields a y-axis as so:</p>

<p><a href="https://i.stack.imgur.com/DyKLn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DyKLn.png" alt="enter image description here"></a></p>

<p>Now the problem is that I want the y-axis to have ticks from <code>[0, -2, -4, -6, -8, -12]</code>. I have played around with the <code>scilimits</code> but to no avail. </p>

<p>How can one force the ticks to only have one significant figure and no trailing zeros, and be floats when required?</p>

<p>MWE added below:</p>

<pre><code>import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 10000.0, 10.)
s = np.sin(np.pi*t)*np.exp(-t*0.0001)

fig, ax = plt.subplots()

ax.tick_params(axis='both', which='major')
plt.ticklabel_format(style='sci', axis='x', scilimits=(0,3))
plt.plot(t,s)

plt.show()
</code></pre>