介绍
这篇文章运用简单易懂的例子给大家介绍python使用matplotlib实现绘制折线图,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
<强>示例代码如下:强>
# !/usr/bin/python # - * -编码:utf - 8 - * 进口matplotlib。pyplot作为plt # figsize -图像尺寸(figsize=(10,10)) # facecolor -背景色(facecolor=癰lue") # dpi -分辨率(dpi=72) 无花果=plt.figure (figsize=(10,10), facecolor=癰lue") # figsize默认为4,4(图像尺寸) ax?=fig.add_subplot(1, 1, 1)行号列位置 # ax2=fig.add_subplot (2, 1, 2) # ax=fig.add_subplot (1, 1, 1) ax1.set_title (“title") #不支持中文 #设置坐标轴的标签 ax1.set_xlabel (“ax?, X") ax1.set_ylabel (“ax?, Y") #设置刻度 # ax1.set_xticks ([1、2、3、4、5)) # ax1.set_yticks([10年,20年,30、40、50)) #设置刻度标签 # ax1.set_xticklabels([“人,“two",“three",“four",“five"]) # alt=" python使用matplotlib实现绘制折线图">关于python使用matplotlib实现绘制折线图就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看的到。
python使用matplotlib实现绘制折线图