import matplotlib.pyplot as plt
import random
import matplotlib
from matplotlib import cycler
from matplotlib.font_manager import FontProperties# 支持的中文字体
font1 = FontProperties(fname=r"c:windows")y = [1, 2, 3, 2, 4, 1, 4, 3, 6, 3, 1, 2, 3, 4, 6, 7, 9, 6, 7, 4]
x = range(11, 31)plt.figure(figsize=(20, 8))plt.plot(x, y)# 调整x轴上的字符串刻度
_x_ticks = ["{}岁".format(i) for i in x ]
icks(x, _x_ticks, fontproperties=font1)
# 绘制网格
id()
plt.show()
import matplotlib.pyplot as plt
import random
import matplotlib
from matplotlib import cycler
from matplotlib.font_manager import FontProperties# 支持的中文字体
font1 = FontProperties(fname=r"c:windows")y = [1, 2, 3, 2, 4, 1, 4, 3, 6, 3, 1, 2, 3, 4, 6, 7, 9, 6, 7, 4]
x = range(11, 31)plt.figure(figsize=(20, 8))plt.plot(x, y)# 调整x轴上的字符串刻度
_x_ticks = ["{}岁".format(i) for i in x ]
icks(x, _x_ticks, fontproperties=icks(range(0,9))# 绘制网格
id()plt.show()
import matplotlib.pyplot as plt
import random
import matplotlib
from matplotlib import cycler
from matplotlib.font_manager import FontProperties# 支持的中文字体
font1 = FontProperties(fname=r"c:windows")y = [1, 2, 3, 2, 4, 1, 4, 3, 6, 3, 1, 2, 3, 4, 6, 7, 9, 6, 7, 4]
x = range(11, 31)plt.figure(figsize=(20, 8))plt.plot(x, y)# 调整x轴上的字符串刻度
_x_ticks = ["{}岁".format(i) for i in x]
icks(x, _x_ticks, fontproperties=icks(range(0, 14))# 绘制网格
id(alpha=0.2)plt.show()
本文发布于:2024-01-29 16:56:41,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170651860516817.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |