matplotlibで、2軸グラフを書く ax2 = twinx() を使うみたい。
http://scienceoss.com/create-a-second-y-axis-in-matplotlib/
http://matplotlib.sourceforge.net/examples/api/two_scales.html
2010年3月1日月曜日
2009年11月21日土曜日
CSVファイルの取り扱い numpy
CSV ファイルの読み込み 戻り値 array型
>>> data = loadtxt("test1.csv",delimiter=",")
列0から列2の取り出し
>>> col_a, col_b, col_c = data[:,0], data[0:,1], data[:,2]
行0の取り出し
>>> row_1 = data[0,:]
array型からlistに変換
>>> row_1
array([ 1., 2., 3.])
>>> list_1 = row_1.tolist()
>>> list_1
[1.0, 2.0, 3.0]
listからarray型に変換
>>> array(list_1)
array([ 1., 2., 3.])
2009年11月17日火曜日
PyQt4 チュートリアル
ドラッグ&ドロップなどのサポート、スピード、綺麗さ、などを考えると、PyQt4を使いたくなってきた。。。
時間があるときでも、、、
PyQt4 Tutorial http://zetcode.com/tutorials/pyqt4/
時間があるときでも、、、
PyQt4 Tutorial http://zetcode.com/tutorials/pyqt4/
2009年11月14日土曜日
リストの要素の近い値のインデックスを返す。numpy searchsorted()
numpy の関数 searchsorted() は、本来 リストに要素を追加したい場合に、そのリストの要素の順序を崩さないように追加できる、インデックスを返す。
>>> tt =[1,2,3,4,5,6,8,9]
>>> np.searchsorted(tt,7)
6
>>> np.searchsorted(tt,2)
1
>>> np.searchsorted(tt,2, side="right")
2
-----------------------------------------------------
numpy.searchsorted(a, v, side='left')
Find indices where elements should be inserted to maintain order.
Find the indices into a sorted array `a` such that, if the corresponding
elements in `v` were inserted before the indices, the order of `a` would
be preserved.
Parameters
----------
a : 1-D array_like of shape (N,)
Input array, sorted in ascending order.
v : array_like
Values to insert into `a`.
side : {'left', 'right'}, optional
If 'left', the index of the first suitable location found is given. If
'right', return the last such index. If there is no suitable
index, return either 0 or N (where N is the length of `a`).
登録:
投稿 (Atom)