datafile: 1 2 3 2 3 4 3 2 3 4 1 2 5 0 1 6 1 0 7 2 1 8 3 2 9 2 3 これを読み込んでプロットしてみる。 load() では駄目で、loadtxt() ならOK。 pylab no longer provides a load function, though the old pylab function is still available as matplotl…
#coding:utf-8 import numpy as np import matplotlib.pyplot as pylab #平均 mu1 = [-2,-2] mu2 = [2,2] #共分散 cov = [[2,1],[1,2]] #500はデータ数 x1,y1 = np.random.multivariate_normal(mu1,cov,500).T x2,y2 = np.random.multivariate_normal(mu2,co…
多分こっちが本家 http://matplotlib.sourceforge.net/gallery.html 簡単な2Dグラフを描画する from pylab import * t = arange(0.0, 1.0+0.01, 0.01) s = cos(2*2*pi*t) plot(t, s, '-', lw=2) xlabel('time (s)') ylabel('voltage (mV)') title('About as …
またまたpythonで! http://toranekosan.blogspot.com/2007/10/python.html pythonでMatplotlib使おう! http://toranekosan.blogspot.com/2007/10/pythonmatplotlib.html y = exp(-(x-0.5)^2) import math def gaussfunc(x,a,b): return math.exp(-a*(x-b)*…
第6回 Numpyの導入 In [1]: import numpy In [2]: numpy.test() Running unit tests for numpy NumPy version 2.0.0.dev-3b3735d NumPy is installed in /Library/Python/2.7/site-packages/numpy-2.0.0.dev_3b3735d_20111219-py2.7-macosx-10.7-x86_64.egg/…
In [1]: %logstart Activating auto-logging. Current session state plus future input saved. Filename : ipython_log.py Mode : rotate Output logging : False Raw input log : False Timestamping : False State : active In [2]: from scipy import * …
In [1]: x = randn(10000) → 正規分布で乱数10000個、のarray([...]) In [2]: hist(x, 100) → ヒストグラム表示