使用matplotlib的频率直方图 - 如何摆脱阵列显示?

时间:2015-05-15 15:18:21

标签: python matplotlib

我创建一个简单的频率直方图:

figure(figsize=(12,9))

ax=subplot(111)
#Get rid of the border lines
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)

#Axis label
xlabel("Gross Earnings", fontsize=16)  
ylabel("Frequency (in thousands)", fontsize=16) 

#Limit the x range so we can see the distribution more closely
xlim(0, 40000)

#Ticks
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()

hist(earnings, weights=wgts, color="#3F5D7D", bins=100) 

我得到的直方图很好,但我也得到了巨型阵列的收益和显示的wgts。我如何摆脱那些?

谢谢!

1 个答案:

答案 0 :(得分:0)

您需要使用;hist添加到行尾。这通常是suppress output,但特别是对于图形调用。 (具有讽刺意味的是,当绘图时,输出是无关紧要的;它是显示绘图的调用的副作用。)

相关问题