官網(wǎng)介紹:
Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shell, the jupyter notebook, web application servers, and four graphical user interface toolkits.
呃。。。Matplotlib就是一個Python 2D繪圖庫,可以用來在多種多樣的硬拷貝格式和交互環(huán)境中生成publication quality figures(看不懂),什么樣的圖形(字面翻譯,出版質(zhì)量的圖形?不通順啊。),Matplotlib可以用在python腳本,python和ipython shell,the jupyter notebook,web應(yīng)用服務(wù)器,和四種圖形化用戶界面工具。
這蹩腳的英語水平。。
反正是用來畫圖的,至于它的應(yīng)用領(lǐng)域,上述講的不是很清楚,以后再慢慢探索吧。
下面看看安裝過程,十分簡單。
命令窗口直接輸入:python -m pip install matplotlib
然后回車即可。
檢查是否安裝成功
導(dǎo)入matplotlib,不報錯即可。
或者在命令行里輸入pip list
,查看本機已安裝的python模塊。
matplotlib簡單實例:
1
2
3
4
5
6
7
8
9
|
import numpy as np import matplotlib.pyplot as plt # 平均采樣時間為200ms t = np.arange( 0. , 5. , 0.2 ) # 紅色的破折號,藍色的正方形,綠色的三角形 plt.plot(t, t, 'r--' , t, t * * 2 , 'bs' , t, t * * 3 , 'g^' ) plt.show() |
運行結(jié)果:
referance:
總結(jié)
以上就是本文關(guān)于matplotlib簡介,安裝和簡單實例代碼的全部內(nèi)容,希望對大家有所幫助。感興趣的朋友可以繼續(xù)參閱本站其他相關(guān)專題,如有不足之處,歡迎留言指出。感謝朋友們對本站的支持!
原文鏈接:https://www.cnblogs.com/zrmw/p/8111461.html