I want to use np.arange()
to define axis tick labels. But several labels go out to crazy decimal places (e.g., 0.850000000000000001 instead of 0.85). Using np.around()
to 2 decimals does not help either because then the numbers have alternating decimal places (0.45, 0.5, 0.55...). How can I just have it write each tick label to 2 decimals? Also, I'll want to change fontsize
for these labels so I need to call ax.set_yticklabels()
x,y = np.arange(0,1,.05), np.arange(0,1,.05)
fig, ax = plt.subplots(1,1)
ax.plot(x,y)
ax.set_yticks(np.arange(0,1,.05))
ax.set_yticklabels(np.arange(0,1,.05))