Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Can Python matplotlib draw a picture and specify the specific value of the Y axis?
Can Python matplotlib draw a picture and specify the specific value of the Y axis?
By default, the y axis will have a value. Do you need to customize it?

You can use the yticks function. The first parameter is the position of the Y axis, and the second parameter is the specific label.

Import? matplotlib.pyplot? As? plt

Import? numpy? As? nameplate

x? =? np.arange(0,6)

y? =? x? *? x

plt.plot(x,y,? marker='o ')

plt.yticks(y,['a ',' b ',' c ',' d ',' e ',' f'])