Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
matplotlibによるグラフ表示
# 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()
@PeaceAndHiLight

This comment has been minimized.

Copy link
Owner Author

PeaceAndHiLight commented Aug 15, 2017

matplotlibのpyplotの機能でsinとcosのグラフを表示させます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.