Ubuntu Python 安裝numpy SciPy、MatPlotLib環境

來源:互聯網
上載者:User

標籤:class   space   war   pac   logs   fse   ati   size   grid   

安裝

sudo apt-get install python-scipy
sudo apt-get install python-numpy
sudo apt-get install python-matplotlib

 

測試

#test plotfrom mpl_toolkits.mplot3d import axes3dimport matplotlib.pyplot as pltfrom matplotlib import cmfig = plt.figure()ax = fig.gca(projection=‘3d‘)X, Y, Z = axes3d.get_test_data(0.05)ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)cset = ax.contour(X, Y, Z, zdir=‘z‘, offset=-100, cmap=cm.coolwarm)cset = ax.contour(X, Y, Z, zdir=‘x‘, offset=-40, cmap=cm.coolwarm)cset = ax.contour(X, Y, Z, zdir=‘y‘, offset=40, cmap=cm.coolwarm)ax.set_xlabel(‘X‘)ax.set_xlim(-40, 40)ax.set_ylabel(‘Y‘)ax.set_ylim(-40, 40)ax.set_zlabel(‘Z‘)ax.set_zlim(-100, 100)plt.show()#test numpyfrom numpy import *print random.rand(4,4)#test scipyimport numpy as npfrom scipy.stats import betafrom matplotlib.pyplot import hist, plot, showobs = beta.rvs(5, 5, size=2000)  # 2000 observationshist(obs, bins=40, normed=True)grid = np.linspace(0.01, 0.99, 100)plot(grid, beta.pdf(grid, 5, 5), ‘k-‘, linewidth=2)show()

 

[[ 0.65980666  0.55674039  0.15432447  0.63885279]
 [ 0.77583865  0.78290332  0.31575893  0.12678885]
 [ 0.67791378  0.86333224  0.97039675  0.95323786]
 [ 0.31306339  0.54107452  0.79611926  0.05306962]]
 

 

Ubuntu Python 安裝numpy SciPy、MatPlotLib環境

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.