美文网首页
python之数据-最易的折线图

python之数据-最易的折线图

作者: magiczero | 来源:发表于2018-08-11 19:25 被阅读0次

      配置环境:在python中install,必须首先安装Numpy(数学包),再安装Matplotlib(图表包),顺便安装SciPy(数学计算包),顺序错会安装失败。

      下面造几个数据,用python画一个最简单的折线图表

      import numpy

      from matplotlib  import pyplot

      list1= []

      for iin range(1,10):

            list1.append(i)

      print(list1)

      x= numpy.array(list1)

      print(x)

      y= x**2

      print(y)

      #figsize表示尺寸,dpi表示鼠标掠过图时,图中值变动的幅度

      pyplot.figure(figsize=(10,5),dpi=80)

      #第三个参数,横杠表示实线,字母o表示点

      pyplot.plot(x, y,"-o")

      pyplot.show()

相关文章

网友评论

      本文标题:python之数据-最易的折线图

      本文链接:https://www.haomeiwen.com/subject/akadbftx.html