import matplotlib.pyplot as plt
input_value=[1,2,3,4,5]
squares=[1,4,9,16,25]
#plt.plot(squares)
plt.plot(input_value,squares,linewidth=5)
#设置图表标题,并给坐标轴加标签
plt.title("Square Numbers",fontsize=24)
plt.xlabel("Value",fontsize=14)
plt.ylabel("Square of Value",fontsize=14)
#设置刻度标记的大小
plt.tick_params(axis='both',labelsize=14)
plt.show()
本文介绍了一个使用Python的Matplotlib库来绘制输入值与其平方关系图表的例子。通过设置线条宽度、图表标题、坐标轴标签及刻度标记大小等属性,使得最终生成的图表既美观又易于理解。

被折叠的 条评论
为什么被折叠?



