How can I change the y-axis ticks and labels in Python? I also want to display the grid at each shown label. When I used the following code, I change the ticks and labels, but it also keeps the default y labels. How to remove the default ticks and labels, and create new ones?
fig, ax = plt.subplots() ax.plot(x, y) start, end = ax.get_ylim() ax.set_yticks(start, end, stepsize) plt.grid(True)