Change Number Formatting on X-Axis Matplotlib -
i'm sure easy answer, not find anywhere. want x-axis read values 2000, 2001, 2002, 2003, 2004, not 2 x e**3.
import numpy np import matplotlib.pyplot plt x = [2000, 2001, 2002, 2003, 2004] y = [2000, 2001, 2002, 2003, 2004] plt.xticks(np.arange(min(x), max(x)+1, 1.0)) plt.plot(x,y) plt.show()
the code returns graph represents values this. how change it?
@ avinash pandey
can use
plt.xticks(np.arange(min(x), max(x)+1, 1.0), x)
try in code space there labels needed... more follow link
Comments
Post a Comment