回答編集履歴
1
コードのコメント間違いを修正
answer
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
[https://matplotlib.org/3.1.1/api/ticker_api.html#matplotlib.ticker.FuncFormatter](https://matplotlib.org/3.1.1/api/ticker_api.html#matplotlib.ticker.FuncFormatter)
|
4
4
|
|
5
5
|
```Python
|
6
|
-
#
|
6
|
+
# Y軸の数字が必ず整数になるようにする
|
7
7
|
plt.gca().get_yaxis().set_major_locator(ticker.MaxNLocator(integer=True))↓
|
8
8
|
```
|
9
9
|
↓
|
10
10
|
```Python
|
11
|
-
#
|
11
|
+
# Y軸の数字を float型からint型に変換する
|
12
12
|
plt.gca().get_yaxis().set_major_formatter(ticker.FuncFormatter(lambda v,p:int(v)))
|
13
13
|
```
|