坐标轴刻度线的设置问题
#practice 绘制折线图,分析从11-30岁,每年交男女朋友的数量走势,a=from matplotlib import pyplot as plt
from matplotlib import font_manager
import random
my_font=font_manager.FontProperties(fname="C:/WINDOWS/fonts/simhei.ttf")
x=range(11,31)
y=
fig=plt.figure(figsize=(10,4),dpi=80)
plt.plot(x,y)
#想给x轴的刻度都写成**岁,尝试未果
_xtick_labels=["{}岁".format(list(x))]
plt.xticks(_xtick_labels,rotation=45,fontproperties=my_font)
plt.show()
道阻且长,打扰各位大佬了{:7_122:} # practice 绘制折线图,分析从11-30岁,每年交男女朋友的数量走势,a=
from matplotlib import pyplot as plt
from matplotlib import font_manager
import random
my_font = font_manager.FontProperties(fname="C:/WINDOWS/fonts/simhei.ttf")
x = range(11, 31)
y =
fig = plt.figure(figsize=(10, 4), dpi=80)
plt.plot(x, y)
_xtick_labels = (f"{i}岁" for i in x)
plt.xticks(x, _xtick_labels, rotation=45, fontproperties=my_font)
plt.show()
页:
[1]