6

Python3.2 で積み上げ棒グラフを生成し、「Matplotlib」モジュール「pyplot」を使用しています。唯一の問題は、「xlabel」に、分析するエントリ数の変数 (整数) を含める必要があることです。いろいろ試しましたが、変数を xlabel に含める方法が見つかりませんでした。

私のコードの一部:

plt.ylabel('Percentage', fontproperties=font_manager.FontProperties(size=10))
plt.xlabel('position', fontproperties=font_manager.FontProperties(size=10))
plt.title("'Graph-A",fontproperties=font_manager.FontProperties(size=10))

plt.xticks(np.arange(22), np.arange(1,23), fontproperties=font_manager.FontProperties(size=8))
plt.yticks(np.arange(0,121,5), fontproperties=font_manager.FontProperties(size=8))
plt.legend((p1[0], p2[0], p3[0], p4[0],p5[0]), ('A','B','C','D','E'), loc=1, prop=font_manager.FontProperties(size=7))

変数 'entries' は処理されたエントリの値を保持し、この値を xlabel に含める必要があります。助けてください?

AK

4

3 に答える 3

9

私があなたを正しく理解したなら、あなたは試すことができます:

plt.xlabel('position %d' % entries, fontproperties=font_manager.FontProperties(size=10))
于 2012-05-03T23:43:42.287 に答える