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

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

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

2019-11-11 04:01:31
字體:
來源:轉載
供稿:網友

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()  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 冷水江市| 保德县| 和田县| 三穗县| 城市| 公安县| 温泉县| 潢川县| 泽库县| 徐汇区| 库尔勒市| 新干县| 达州市| 辰溪县| 金寨县| 高州市| 鸡东县| 南投市| 九龙坡区| 宜良县| 额尔古纳市| 麻栗坡县| 吉安县| 平谷区| 沛县| 凤城市| 南平市| 孝昌县| 丹棱县| 台中县| 当雄县| 古丈县| 金秀| 海城市| 罗平县| 伊吾县| 同江市| 永吉县| 原平市| 缙云县| 新民市|