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

質問編集履歴

2

変更

2020/04/04 02:37

投稿

pon244
pon244

スコア59

title CHANGED
File without changes
body CHANGED
@@ -21,6 +21,8 @@
21
21
  # 上に積み上げる棒グラフを作成する
22
22
  plt.bar(left, height2, bottom=height1, width = width,color="orange")
23
23
 
24
+ ```
25
+
24
26
  【グラフ結果】
25
27
  ![イメージ説明](5cd664dd95b73f6f245b52bc57044cc5.png)
26
28
 

1

code

2020/04/04 02:37

投稿

pon244
pon244

スコア59

title CHANGED
File without changes
body CHANGED
@@ -1,17 +1,26 @@
1
1
  ```ここに言語を入力
2
+ #>>> %matplotlib inline
2
3
  import numpy as np
3
4
  import matplotlib.pyplot as plt
5
+ import matplotlib.ticker as ticker
6
+ plt.gca().get_yaxis().get_major_formatter().set_useOffset(False)
4
7
 
8
+ # X軸の数字が必ず整数になるようにする
9
+ plt.gca().get_yaxis().set_major_locator(ticker.MaxNLocator(integer=True))
10
+
5
11
  left = x
6
12
  height1 = y
7
13
  height2 = y2
8
14
  width = 6.0
15
+
16
+
9
- # 棒グラフを作成する
17
+ # X軸の数字が必ず整数ようにする
18
+
10
19
  plt.bar(left, height1, width = width,color="lightblue")
11
20
  plt.xticks(x, rotation=90)
12
21
  # 上に積み上げる棒グラフを作成する
13
22
  plt.bar(left, height2, bottom=height1, width = width,color="orange")
14
- ```
23
+
15
24
  【グラフ結果】
16
25
  ![イメージ説明](5cd664dd95b73f6f245b52bc57044cc5.png)
17
26