国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

matplotlib的常用的兩種方式以及pylab

2019-11-11 04:29:27
字體:
來源:轉載
供稿:網友

pylab不推薦使用的原因:pylab更接近于MATLAB,這是毋庸置疑的,但是使用pylab會逐漸背離matplotlib的學習,這與初衷想反,當然,還有其他的原因,沒有研究。

三種方式的實現代碼(相對來說 matplotlib 實現更簡單)

pyplot的方式

[python] view plain copy 在CODE上查看代碼片#!/usr/bin/python  #coding: utf-8    import numpy as np  import matplotlib.pyplot as plt    x = np.arange(0, 10, 1)  y = np.random.randn(len(x))    plt.title("pyplot")    plt.plot(x, y)  plt.show()  

pylab的方式

[python]%20view%20plain%20copy%20#!/usr/bin/python  #coding: utf-8    from pylab import *    x = arange(0, 10, 1)  y = randn(len(x))    title("pylab")  plot(x, y)  show()  

類封裝的方式

[python]%20view%20plain%20copy%20#!/usr/bin/python  #coding: utf-8    import numpy as np  import matplotlib.pyplot as plt    x = np.arange(0, 10, 1)  y = np.random.randn(len(x))    # 生成一個figure對象  fig = plt.figure()  ax = fig.add_subplot(111)    plt.plot(x, y)    ax.set_title("object oriented")    plt.show()  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 呼伦贝尔市| 内黄县| 陇南市| 雷山县| 独山县| 开封县| 旅游| 工布江达县| 德令哈市| 绍兴市| 鄂托克旗| 新郑市| 株洲县| 阿拉善右旗| 昌黎县| 利辛县| 喜德县| 高陵县| 双城市| 突泉县| 和静县| 纳雍县| 阳谷县| 平顺县| 怀集县| 满城县| 宜丰县| 永福县| 桃园市| 白山市| 桐乡市| 达拉特旗| 额尔古纳市| 资兴市| 饶平县| 奎屯市| 杭州市| 平果县| 泾阳县| 九寨沟县| 天祝|