Matplotlib: Format Axis Ticks Without Offset
I want to format my ticks to a certain number of significant figures, AND remove the automatic offset. For the latter I am using https://stackoverflow.com/a/6654046/1021819, and fo
Solution 1:
FormatStrFormatter
doesn't use an offset, so by using your second format you automatically won't have an offset.
Compare the two subplots in this example
import matplotlib.pyplotas plt
import matplotlib.tickeras mtick
import numpy as np
fig,(ax1,ax2)=plt.subplots(2)
ax1.plot(np.arange(10000,10010,1))
ax2.plot(np.arange(10000,10010,1))
ax2.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.4e'))
plt.show()
Post a Comment for "Matplotlib: Format Axis Ticks Without Offset"