pyplot.show()を下記のプログラムで記載してにないにも関わらず、pyplot.bar()を実行した段階でnotebook上でグラフが表示されます。
公式ドキュメントをみても、pyplot.barでは棒グラフを作成するだけであって表示されるとは記載がありません。
これはどのような理由なのでしょうか?
よろしくお願いします。
python
1import numpy as np 2import numpy.random as random 3import scipy as sp 4import pandas as pd 5from pandas import Series, DataFrame 6 7# 可視化ライブラリ 8import matplotlib.pyplot as plt 9import matplotlib as mpl 10import seaborn as sns 11sns.set() 12%matplotlib inline 13 14# 小数第3位まで表示 15%precision 3 16 17# 表示するデータ 18x = [1, 2, 3] 19y = [10, 1, 4] 20 21# グラフの大きさ指定 22plt.figure(figsize = (10, 6)) 23 24plt.bar(x, y, align='center', width = 0.5) 25 26# 棒グラフそれぞれのラベル 27plt.xticks(x, ['A Class', 'B Class', 'C Class']) 28 29# xとyのラベルを設定 30plt.xlabel('Class') 31plt.ylabel('Score') 32 33# グリッドを表示 34plt.grid(True)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/09 04:27 編集
2020/01/09 04:35
2020/01/09 04:41
2020/01/09 05:15