'''导入模块pyplot,并且定义别名plt '''
import matplotlib.pyplot as plt
'''创建列表并且传递给函数plot();linewidth决定绘制线条的粗细'''
squares=[1,4,9,16,25]
plt.plot(squares,linewidth=5)
'''函数title()给图表指定标题;参数fontsize指定图表中文字大小'''
plt.title("Squre Numbers",fontsize=24)
'''函数xlabel()和ylabel()为每条轴设置标题'''
plt.xlabel("Value",fontsize=14)
plt.ylabel("Value",fontsize=14)
'''函数tick_params()设置刻度标记的大小'''
plt.tick_params(axis='both',labelsize=14)
plt.show()
matplotlib绘制简单折线图
猜你喜欢
转载自blog.csdn.net/why_cant_i_change/article/details/81543393
今日推荐
周排行