質問編集履歴
6
微修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,9 +91,9 @@
|
|
91
91
|
ax = df.plot()
|
92
92
|
ax.set_xlabel("Time $\it{t}$ ns",fontsize=10)
|
93
93
|
ax.set_ylabel("Gate-Source Voltage $\it{V_{\mathsf{GS}}}}$ V",fontsize=10)
|
94
|
-
|
94
|
+
ax.grid()
|
95
|
-
|
95
|
+
ax.plot()
|
96
96
|
```
|
97
97
|
|
98
98
|
実行結果(目的のグラフを描画できた):
|
99
|
-

|
5
目的のグラフを得られた。最終修正版。
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,3 +78,22 @@
|
|
78
78
|
|
79
79
|
再度修正したプログラムの2回目の実行結果:
|
80
80
|

|
81
|
+
|
82
|
+
|
83
|
+
最終的なプログラム(回答者様のコードをCSVを取り込められるように改変):
|
84
|
+
```Python
|
85
|
+
import pandas as pd
|
86
|
+
import matplotlib.pyplot as plt
|
87
|
+
|
88
|
+
#CSVファイルをUTF-8形式で読み込む
|
89
|
+
|
90
|
+
df = pd.read_csv('000.csv',encoding = 'UTF8', index_col='time')
|
91
|
+
ax = df.plot()
|
92
|
+
ax.set_xlabel("Time $\it{t}$ ns",fontsize=10)
|
93
|
+
ax.set_ylabel("Gate-Source Voltage $\it{V_{\mathsf{GS}}}}$ V",fontsize=10)
|
94
|
+
df.grid()
|
95
|
+
df.plot()
|
96
|
+
```
|
97
|
+
|
98
|
+
実行結果(目的のグラフを描画できた):
|
99
|
+

|
4
再度プログラムを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -55,3 +55,26 @@
|
|
55
55
|
|
56
56
|
修正したプログラムの結果:
|
57
57
|

|
58
|
+
|
59
|
+
|
60
|
+
再度修正したプログラム:
|
61
|
+
```Python
|
62
|
+
import pandas as pd
|
63
|
+
import matplotlib.pyplot as plt
|
64
|
+
|
65
|
+
#CSVファイルをUTF-8形式で読み込む
|
66
|
+
|
67
|
+
df = pd.read_csv('000.csv',encoding = 'UTF8', index_col='time')
|
68
|
+
plt.xlabel("Time $\it{t}$ ns",fontsize=22)
|
69
|
+
plt.ylabel("Gate-Source Voltage $\it{V_{\mathsf{GS}}}}$ V",fontsize=22)
|
70
|
+
#dataを出力
|
71
|
+
plt.grid()
|
72
|
+
df.plot()
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
再度修正したプログラムの1回目の実行結果:
|
77
|
+

|
78
|
+
|
79
|
+
再度修正したプログラムの2回目の実行結果:
|
80
|
+

|
3
修正した結果のついか
test
CHANGED
File without changes
|
test
CHANGED
@@ -37,3 +37,21 @@
|
|
37
37
|
|
38
38
|
|
39
39
|
```
|
40
|
+
|
41
|
+
修正したプログラム(今度はデータを描画できない):
|
42
|
+
```Python
|
43
|
+
import pandas as pd
|
44
|
+
import matplotlib.pyplot as plt
|
45
|
+
|
46
|
+
#CSVファイルをUTF-8形式で読み込む
|
47
|
+
|
48
|
+
df = pd.read_csv('000.csv',encoding = 'UTF8', index_col='time')
|
49
|
+
plt.xlabel("Time $\it{t}$ ns",fontsize=22)
|
50
|
+
plt.ylabel("Gate-Source Voltage $\it{V_{\mathsf{GS}}}}$ V",fontsize=22)
|
51
|
+
#dataを出力
|
52
|
+
#plt.grid()
|
53
|
+
plt.plot()
|
54
|
+
```
|
55
|
+
|
56
|
+
修正したプログラムの結果:
|
57
|
+

|
2
グリッドの表示について
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
時間と電圧に関するCSVファイルをグラフ化したいのですが、横軸・縦軸に軸名を表示できないです。
|
2
|
+
またグリッドの表示もうまくできないです。
|
2
3
|
|
3
4
|
グラフ描画したいデータ:
|
4
5
|

|
1
実行結果(エラー)の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,3 +17,22 @@
|
|
17
17
|
#plt.grid()
|
18
18
|
plt.plot()
|
19
19
|
```
|
20
|
+
|
21
|
+
実行結果:
|
22
|
+
```Python
|
23
|
+
runfile('C:/Users/ISDka/.spyder-py3/testCSV.py', wdir='C:/Users/ISDka/.spyder-py3')
|
24
|
+
Traceback (most recent call last):
|
25
|
+
|
26
|
+
File C:\anaconda\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
|
27
|
+
exec(code, globals, locals)
|
28
|
+
|
29
|
+
File c:\users\isdka\.spyder-py3\testcsv.py:7
|
30
|
+
plt.xlabel("Drain Voltage $\it{V_{\mathsf{DS}}}$ V",fontsize=22)
|
31
|
+
|
32
|
+
File C:\anaconda\lib\site-packages\pandas\core\generic.py:5902 in __getattr__
|
33
|
+
return object.__getattribute__(self, name)
|
34
|
+
|
35
|
+
AttributeError: 'DataFrame' object has no attribute 'xlabel'
|
36
|
+
|
37
|
+
|
38
|
+
```
|