コード例 #1
0
ファイル: data4paper.py プロジェクト: PeterWanng/hfs
# -*- coding=utf-8 -*-
import os
import sys
sys.path.append('..\..')
from tools import commontools as gtf
from matplotlib import pyplot as plt

gt = gtf()


def draw(averageresult):
    x = x = [500, 1000, 5000, 10000, 50000, 150000, 250000]
    #range(len(averageresult[0]))
    #     print len(averageresult[0]),len(averageresult[1]),'\n',len(x)

    #     plt.title(fname)
    try:
        fig1 = plt.loglog(x, averageresult[0][0:], marker='o')
        fig2 = plt.loglog(x, averageresult[1][0:], marker='x')


#         plt.show()
    except:
        pass

    plt.xlabel('Period')
    plt.ylabel('Fans')
    plt.legend(('Success', 'Failture'), loc=2)
    plt.show()
    #     figname=outfilepath+'.png'
    # pylab.savefig(figname)
コード例 #2
0
ファイル: analyzeResults.py プロジェクト: PeterWanng/hfs
#encoding=utf8
import numpy
import matplotlib.pylab as plt
from tools import commontools as gtf
import csv
import time

import os

gt = gtf()


def mentionlistDis(
    mentionlistpath=r'G:\HFS\WeiboData\HFSWeiboStatNet\Stat\test\Mentioncntlist.txt',
    savefigpath=r'G:\HFS\WeiboData\HFSWeiboStatNet\Stat\test\Mentioncntlist.png'
):
    a = [
        '3342670838100183.repost', 0, 1, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0
    ]
    #     a = gt.csv2list_new(r'G:\HFS\WeiboData\CommonWeiboStatNet\Stat\Mentioncntlist.txt')#_test
    b = gt.csv2list_new(mentionlistpath)  #_test
    lineall = []
    #     for line in a:
    #         lineNew = map(int,line[1:])
    #         lineall.extend(lineNew)
    #         lineNew = []
    # print  lineall
    for line in b:
        lineNew2 = map(int, line[1:])
        lineall.extend(lineNew2)