python pyplot でグラフ

math.sin()でなくnp.sin()を使う
import matplotlib.pyplot as plt
import numpy as np


x=np.arange(-np.pi,np.pi,.1)

y = np.sin(x)

plt.plot(x,y)
plt.hlines([0,-1,1], x[0],x[-1], linestyles="dashed") 
plt.show()

コメント

このブログの人気の投稿

VB.net Dictionaryクラスの初期化

VB.NET 実行中のクラス名とメソッド名を取得

フルパスファイル名と日付をサブディレクトリ込みで取得する方法