teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追記

2020/10/28 00:06

投稿

jeanbiego
jeanbiego

スコア3966

answer CHANGED
@@ -15,4 +15,20 @@
15
15
  plt.plot(x, y/3)
16
16
 
17
17
  plt.show()
18
+ ```
19
+
20
+ numpy使いたくない場合はこちら
21
+ ```python3
22
+ import matplotlib.pyplot as plt
23
+ %matplotlib inline
24
+
25
+ x = [*range(1,6)]
26
+ y = [X**2 for X in x]
27
+ y2 = [(X**2)/2 for X in x]
28
+ y3 = [(X**2)/3 for X in x]
29
+ plt.plot(x, y)
30
+ plt.plot(x, y2)
31
+ plt.plot(x, y3)
32
+
33
+ plt.show()
18
34
  ```

2

コード修正

2020/10/28 00:06

投稿

jeanbiego
jeanbiego

スコア3966

answer CHANGED
@@ -8,7 +8,7 @@
8
8
  %matplotlib inline
9
9
 
10
10
  x = np.array(range(1,6))
11
- y = np.array([X **2 for X in x])
11
+ y = x**2
12
12
 
13
13
  plt.plot(x, y)
14
14
  plt.plot(x, y/2)

1

修正

2020/10/28 00:03

投稿

jeanbiego
jeanbiego

スコア3966

answer CHANGED
@@ -7,7 +7,7 @@
7
7
  import numpy as np
8
8
  %matplotlib inline
9
9
 
10
- x = np.array([*range(1,6)])
10
+ x = np.array(range(1,6))
11
11
  y = np.array([X **2 for X in x])
12
12
 
13
13
  plt.plot(x, y)