24小时热门版块排行榜    

查看: 1531  |  回复: 7
本帖产生 1 个 程序强帖 ,点击这里进行查看
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

bafeite

铜虫 (正式写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
jjdg: 金币+3, 程序强帖+1, 辛苦了 2012-04-27 13:51:17
xiexieliutao: 金币+5, ★★★很有帮助 2012-07-17 18:51:26
我用python实现完全程序画法,代码如下:
CODE:
import numpy as np
import matplotlib.pyplot as plt

N=5
menmeans=(20,35,30,35,27)
womenmeans=(25,32,41,27,30)
ind=np.arange(N)
width=0.32

fig=plt.figure(figsize=(9,7),dpi=120,facecolor='w')
ax=fig.add_subplot(111)
rects1=ax.bar(ind,menmeans,width,color='r')  
rects2=ax.bar(ind+width,womenmeans,width,color='y')

ax.set_xticks(ind+width)
ax.set_xlim([-0.5,5])
leg=ax.legend((rects1[0],rects2[0]),('men','women'),fancybox=True)
# set the alpha value of the legend: it will be translucent
leg.get_frame().set_alpha(0.5)  

def autoplot (rects):
    # attach some text labels
    for rect1,rect2  in rects:
        height1=rect1.get_height()
        height2=rect2.get_height()
        plt.plot([rect1.get_x()+rect1.get_width()/2.,rect2.get_x()+rect2.get_width()/2.],[height1,height2], lw=6.0)
            
autoplot(zip(rects1,rects2))
plt.savefig("bar_chart_new.png",dpi=200)
plt.show()

所绘结果如下图:
 
7楼2012-04-19 15:18:58
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 xiexieliutao 的主题更新
信息提示
请填处理意见