matplotlib.pyplot.plot()

matplotlib.pyplot.plot()是matplotlib库中的一个函数,plot有绘图之意,py是python的简写。

matplotlib.pyplot.plot(*args, **kwargs)
    下面是plot函数得两种形式,plot把x与y画成线,或者标记( Plot y versus x as lines and/or markers),第二种形式在一个图中要画出多条线的话可以用,同样也可以重复使用形式一达到目的
plot([x], y, [fmt], data=None, **kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)其中可以缺少x的数据,会自动以自然数的形式补齐(0,1......n)

1.输入数据类型

    (1)x 和 y 都是一维列表或数组;

    (2)x 是n*1数组或列表,y是一维长度为n的数组或列表;

    (3)x是m*n数组或列表,y是m*1列表或数组。如下例子,画出的图如下。

会产生20个点,十对。

x = [[-0.07816532  0.05068012  0.07786339  0.05285819  0.07823631  0.0644473
   0.02655027 -0.00259226  0.04067226 -0.00936191]
 [ 0.0090156   0.05068012 -0.03961813  0.0287581   0.03833367  0.0735286

  -0.07285395  0.1081111   0.01556684 -0.04664087]]

y = [ 201.12401963  150.05917612]

matplotlib.pyplot.plot(x,y)


2.fmt是shortcut string notation ,其形式为 

    fmt = '[color][marker][line]',颜色,点标记类型,画线类型。

    (1)颜色表:

character color
'b' blue
'g' green
'r' red
'c' cyan
'm' magenta
'y' yellow
'k' black
'w' white

    (2)点类型

character description
'.' point marker
',' pixel marker
'o' circle marker
'v' triangle_down marker
'^' triangle_up marker
'<' triangle_left marker
'>' triangle_right marker
'1' tri_down marker
'2' tri_up marker
'3' tri_left marker
'4' tri_right marker
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值