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

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

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

2019-11-11 05:57:59
字體:
來源:轉載
供稿:網友

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()  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邓州市| 金乡县| 靖宇县| 天津市| 永川市| 夏津县| 新化县| 万荣县| 金阳县| 库尔勒市| 绥江县| 康马县| 喜德县| 扶绥县| 邹平县| 河间市| 沙洋县| 江都市| 巴彦淖尔市| 镇安县| 阆中市| 响水县| 泽库县| 和龙市| 岫岩| 古丈县| 合江县| 杂多县| 博湖县| 石屏县| 大埔县| 株洲县| 十堰市| 琼海市| 延寿县| 正镶白旗| 永济市| 忻城县| 苗栗县| 许昌县| 思南县|