Skip to content

Instantly share code, notes, and snippets.

@kurenaif
Created February 1, 2015 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurenaif/c900a573054bc11c3f38 to your computer and use it in GitHub Desktop.
Save kurenaif/c900a573054bc11c3f38 to your computer and use it in GitHub Desktop.
csvファイルをmatplotlibで描画するまで
import csv
import matplotlib.pyplot as plt
f = open("data.csv", "r")
data = csv.reader(f)
x = []
y0 = []
y1 = []
y2 = []
for row in data:
x.append(int(row[0]))
y0.append(int(row[1]))
y1.append(int(row[2]))
y2.append(int(row[3]))
plt.title("data")
plt.xlabel("x")
plt.ylabel("y")
plt.plot(x,y0, label="y=x")
plt.plot(x,y1,label="y=x^2")
# plt.plot(x,y2,label="y=x^3")
plt.legend()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment