2014年11月30日日曜日

141130

NumPy, Matplotlib


山の描画

>>> import pylab as pl
>>> import numpy as np
>>> points = np.arange(-5,5,0.1)
>>> xs, ys = np.meshgrid(points, points)
>>> z = np.sqrt(xs**2 + ys**2)
>>> pl.imshow(z, cmap=pl.cm.gray); pl.colorbar()
<matplotlib.image.AxesImage object at 0x034EBA90>
<matplotlib.colorbar.Colorbar instance at 0x03550850>
>>> pl.title("Image plot of sqrt(x**2 + y**2) for a grid of values")
<matplotlib.text.Text object at 0x034DE730>
>>> pl.show()

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。