001.matplotlib.pyplot入门

001.matplotlib.pyplot入门

1.简单程序

  • 画图plot方法
  • 显示图片show方法
    001.matplotlib.pyplot入门_第1张图片
    001.matplotlib.pyplot入门_第2张图片

2.画多张图

001.matplotlib.pyplot入门_第3张图片
001.matplotlib.pyplot入门_第4张图片

3.figure函数

**matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=, clear=False, kwargs)

  • num: 图的identifier,是唯一的(str或者int类型)
  • figsize(float, float): Width, height in inches.
  • facecolor:The background color.
  • edgecolor: The border color.

4.plot函数

4.1 常用的形式

# 一个figure里面一条线
plot([x], y, [fmt], *, data=None, **kwarg)
# 一个figure里面多条线
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwarg)

[fmt]指的是线条的格式:[颜色,点型,线型]

4.2 其他参数

  • linewidth = 2 线宽
  • markersize = 12 点宽
  • label = ‘line1’ 线的标签,但是不会在图中显示
    点型
    001.matplotlib.pyplot入门_第5张图片
    001.matplotlib.pyplot入门_第6张图片
    001.matplotlib.pyplot入门_第7张图片

你可能感兴趣的:(#,Matplotlib,matplotlib,pyplot,数据可视化,python,数据分析)