回答編集履歴
1
d
answer
CHANGED
@@ -15,4 +15,35 @@
|
|
15
15
|
ax.fill_between(x, y1, y2, alpha=0.5)
|
16
16
|
```
|
17
17
|
|
18
|
-

|
18
|
+

|
19
|
+
|
20
|
+
## 追記
|
21
|
+
|
22
|
+
以下のようにしてみてはどうでしょうか。
|
23
|
+
|
24
|
+
```python
|
25
|
+
fig, ax = plt.subplots(figsize=(5, 5))
|
26
|
+
|
27
|
+
x1 = np.linspace(0, 10, 1000)
|
28
|
+
y1 = np.sin(x1)
|
29
|
+
|
30
|
+
x2 = np.linspace(0, 10, 100)
|
31
|
+
y2 = np.cos(x2)
|
32
|
+
|
33
|
+
ax.plot(x1, y1, "k", label="sin")
|
34
|
+
ax.plot(x2, y2, "k", label="cos")
|
35
|
+
ax.legend()
|
36
|
+
|
37
|
+
ax.fill(np.append(x1, x2[::-1]), np.append(y1, y2[::-1]))
|
38
|
+
```
|
39
|
+
|
40
|
+
コメントのコードの場合以下
|
41
|
+
|
42
|
+
```python
|
43
|
+
plt.plot(
|
44
|
+
x1_list, z1_list, color="Black", alpha=0.5, linewidth=4.0, label="data1"
|
45
|
+
)
|
46
|
+
plt.plot(x2_list, z2_list, color="Black", alpha=0.8, linewidth=4.0, label="data2")
|
47
|
+
plt.legend()
|
48
|
+
ax.fill(np.append(x1_list, x2_list[::-1]), np.append(z1_list, z2_list[::-1]))
|
49
|
+
```
|