graph.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:twitter-bot-detection 作者: franckbrignoli 项目源码 文件源码
def hist_weekday(self, tweet_weekday_user, tweet_weekday_bot, path):
        fig = plt.figure()
        ax = plt.subplot(111)

        opacity = 0.4
        labels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        bar_width = 0.3
        x = range(len(tweet_weekday_user["prop"]))

        plt.xticks([0.3, 1.3, 2.3, 3.3, 4.3, 5.3, 6.3], labels)
        ax.bar(x, tweet_weekday_user["prop"],bar_width,color='b',alpha=opacity,label='Humans', yerr=tweet_weekday_user["std"])
        ax.bar([0.3, 1.3, 2.3, 3.3, 4.3, 5.3, 6.3], tweet_weekday_bot["prop"],bar_width,color='g',alpha=opacity,label='Bots', yerr=tweet_weekday_bot["std"])

        ax.set_xlabel('Week days')
        ax.set_ylabel('Tweets proportion per day (0 to 1)')
        sns.plt.title('Proportion of tweets for each week day')
        ax.legend()
        pl.savefig(path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号