Created
August 15, 2017 13:29
-
-
Save PeaceAndHiLight/085b10c92353cb0c68aaf0fc5d45532b to your computer and use it in GitHub Desktop.
matplotlibによるグラフ表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# 0から6まで0.1刻みで配列に格納する | |
x = np.arange(0, 6, 0.1) | |
# xの値を入力に、sinとcosの配列を作る | |
y1 = np.sin(x) | |
y2 = np.cos(x) | |
# pyplotの機能でグラフ表示 | |
plt.plot(x,y1,label="sin") | |
plt.plot(x,y2,linestyle="--", label="cos") | |
plt.xlabel("x") | |
plt.ylabel("y") | |
plt.title('sin & cos') | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
matplotlibのpyplotの機能でsinとcosのグラフを表示させます。