コード例 #1
0
ファイル: plotsfdegevol.py プロジェクト: kemas/ns3
def main(argv):
    argid = {'func':['-id'], 'files':['simdata/svcsimn_d4a1_4.json'], '-m':['plus'], '-yl':['In-degree'], '-axisfsize':['large'], '-j':[1]}
    argavgid = {'func':['-ad'], 'files':['simdata/svcsimn_d4a1_4.json'], '-m':['plus'], '-xl':['Timestep'], '-yl':['Average in-degree'], '-axisfsize':['large'], '-j':[150]}

    #ax = p.plt.axes([0.13, 0.15, 0.6, 0.75])
    p.plt.subplot(211)

    p.plotdata(pl.loadarg([argid])
        , xylabels={'x': pl.getargval(argid, '-xl', [''])[0], 'y': pl.getargval(argid, '-yl', [''])[0]}
        , markset=pl.getargval(argid, '-m', ['var'])[0]
        , isbase=False
        , xlim=pl.getargval(argid, '-xlim')
        , ylim=pl.getargval(argid, '-ylim')
        , legloc=int(pl.getargval(argid, '-loc', ['1'])[0])
        , ncol=int(pl.getargval(argid, '-ncol', ['1'])[0])
        , numpoints=int(pl.getargval(argid, '-numpoints', ['1'])[0])
        , axisfsize=pl.getaxisfsize(argid))

    p.plt.subplot(212)

    p.plotdata(pl.loadarg([argavgid])
        , xylabels={'x': pl.getargval(argavgid, '-xl', [''])[0], 'y': pl.getargval(argavgid, '-yl', [''])[0]}
        , markset=pl.getargval(argavgid, '-m', ['var'])[0]
        , isbase=False
        , xlim=pl.getargval(argavgid, '-xlim')
        , ylim=pl.getargval(argavgid, '-ylim')
        , legloc=int(pl.getargval(argavgid, '-loc', ['1'])[0])
        , ncol=int(pl.getargval(argavgid, '-ncol', ['1'])[0])
        , numpoints=int(pl.getargval(argavgid, '-numpoints', ['1'])[0])
        , axisfsize=pl.getaxisfsize(argavgid))

    p.plt.gcf().suptitle('In-degree of each random failed service (top) and the average in-degree\n of the available services (bottom) during cascading failure simulation', fontsize=14)
    p.processplot(p.plt)
コード例 #2
0
ファイル: plotpwsf_outdist.py プロジェクト: kemas/ns3
def main(argv):
    sfarg = {'func':['-do'], 'files':['simdata/svcsimn_d4a1_1.json'], '-m':['red'], '-t':['Out-degree distribution of scale-free and ProgrammableWeb service networks'], '-xl':['Out-degree $k_{out}$'], '-yl':['Probability distribution $P(k_{out})$\nScale-free'], '-l':['Scale-free'], '-loc':[2], '-axisfsize':['large'], '-logy':[1], '-ylim':[0.1, 1.3]}
    pwarg = {'func':['-do'], 'files':['simdata/pwsvc_1.json'], '-m':['diamond'], '-yl':['ProgrammableWeb'], '-l':['ProgrammableWeb'], '-axisfsize':['large'], '-loc':[1], '-logy':[1], '-ylim':[1e-05, 4]}

    ax = p.plt.axes([0.13, 0.12, 0.6, 0.78])
    logx, logy = pl.getlogparam(sfarg)

    p.plotdegdist(pl.loadarg([sfarg])
        , pl.getargval(sfarg, '-l')
        , pl.getargval(sfarg, '-m', ['var'])[0]
        , title=pl.getargval(sfarg, '-t', [''])[0]
        , xylabels={'x': pl.getargval(sfarg, '-xl', [''])[0], 'y': pl.getargval(sfarg, '-yl', [''])[0]}
        , nbins=int(pl.getargval(sfarg, '-b', ['50'])[0])
        , logx=logx, logy=logy
        , xlim=pl.getargval(sfarg, '-xlim')
        , ylim=pl.getargval(sfarg, '-ylim')
        , legloc=int(pl.getargval(sfarg, '-loc', [2])[0])
        , axisfsize=pl.getaxisfsize(sfarg)
        , ax=ax)

    ax.set_ylabel(ax.get_ylabel(), color='red')
    for tl in ax.get_yticklabels():
        tl.set_color('red')

    ax2 = p.plt.twinx(ax)
    logx, logy = pl.getlogparam(pwarg)

    p.plotdegdist(pl.loadarg([pwarg])
        , pl.getargval(pwarg, '-l')
        , pl.getargval(pwarg, '-m', ['var'])[0]
        , title=pl.getargval(pwarg, '-t', [''])[0]
        , xylabels={'x': pl.getargval(pwarg, '-xl', [''])[0], 'y': pl.getargval(pwarg, '-yl', [''])[0]}
        , nbins=int(pl.getargval(pwarg, '-b', ['50'])[0])
        , logx=logx, logy=logy
        , xlim=pl.getargval(pwarg, '-xlim')
        , ylim=pl.getargval(pwarg, '-ylim')
        , legloc=int(pl.getargval(pwarg, '-loc', [2])[0])
        , axisfsize=pl.getaxisfsize(pwarg)
        , ax=ax2)

    ax2.set_ylabel(ax2.get_ylabel(), color='#003200')
    for tl in ax2.get_yticklabels():
        tl.set_color('#003200')

    p.processplot(p.plt)
コード例 #3
0
ファイル: plotindegdist.py プロジェクト: kemas/ns3
def main(argv):
    argsf = {'func':['-li'], 'files':['simdata/svcsimn_d2a1_6.json', 'simdata/svcsimn_d3a1_2.json', 'simdata/svcsimn_d4a1_2.json'], '-m':['red'], '-yl':['$P(k_{in})$'], '-axisfsize':['large'], '-lb':[1.21], '-gl':[0], '-loc':[1], '-l':['sf, $\langle{dep}\\rangle = 1$', 'sf, $\langle{dep}\\rangle \\approx 1.5$', 'sf, $\langle{dep}\\rangle \\approx 2$']}
    argexp = {'func':['-di'], 'files':['simdata/expsvcsimn_d2a1_5.json', 'simdata/expsvcsimn_d3a1_2.json', 'simdata/expsvcsimn_d4a1_3.json'], '-m':['blue'], '-xl':['In-degree $k_{in}$'], '-axisfsize':['large'], '-logy':[1], '-l':['exp, $\langle{dep}\\rangle = 1$', 'exp, $\langle{dep}\\rangle \\approx 1.5$', 'exp, $\langle{dep}\\rangle \\approx 2$']}
    argrand = {'func':['-di'], 'files':['simdata/randsvcsimn_d2a1_5.json', 'simdata/randsvcsimn_d3a1_2.json', 'simdata/randsvcsimn_d4a1_3.json'], '-m':['yellow'], '-axisfsize':['large'], '-l':['rand, $\langle{dep}\\rangle = 1$', 'rand, $\langle{dep}\\rangle \\approx 1.5$', 'rand, $\langle{dep}\\rangle \\approx 2$']}

    p.plt.subplot(131)

    p.drawloglogdist(pl.loadarg([argsf])
        , xlabel=pl.getargval(argsf, '-xl', [''])[0]
        , ylabel=pl.getargval(argsf, '-yl', [''])[0]
        , title=pl.getargval(argsf, '-t', [''])[0]
        , markset=pl.getargval(argsf, '-m', ['var'])[0]
        , xlim=pl.getargval(argsf, '-xlim')
        , ylim=pl.getargval(argsf, '-ylim')
        , axisfsize=pl.getaxisfsize(argsf)
        , logbinbase=pl.getargval(argsf, '-lb', [1.21])[0]
        , showexp=int(pl.getargval(argsf, '-g', [1])[0])
        , legloc=int(pl.getargval(argsf, '-loc', [1])[0])
        , isexpline=int(pl.getargval(argsf, '-gl', [1])[0]))

    legend = p.plt.legend(argsf['-l'], labelspacing=0.1, numpoints=1)
    p.plt.setp(legend.get_texts(), fontsize=12)

    p.plt.subplot(132)
    logx, logy = pl.getlogparam(argexp)

    p.plotdegdist(pl.loadarg([argexp])
        , markset=pl.getargval(argexp, '-m', ['var'])[0]
        , title=pl.getargval(argexp, '-t', [''])[0]
        , xylabels={'x': pl.getargval(argexp, '-xl', [''])[0], 'y': pl.getargval(argexp, '-yl', [''])[0]}
        , nbins=int(pl.getargval(argexp, '-b', ['50'])[0])
        , logx=logx, logy=logy
        , xlim=pl.getargval(argexp, '-xlim')
        , ylim=pl.getargval(argexp, '-ylim')
        , legloc=int(pl.getargval(argexp, '-loc', [2])[0])
        , axisfsize=pl.getaxisfsize(argexp))

    legend = p.plt.legend(argexp['-l'], labelspacing=0.1, numpoints=1)
    p.plt.setp(legend.get_texts(), fontsize=12)

    p.plt.subplot(133)
    logx, logy = pl.getlogparam(argrand)

    p.plotdegdist(pl.loadarg([argrand])
        , markset=pl.getargval(argrand, '-m', ['var'])[0]
        , title=pl.getargval(argrand, '-t', [''])[0]
        , xylabels={'x': pl.getargval(argrand, '-xl', [''])[0], 'y': pl.getargval(argrand, '-yl', [''])[0]}
        , nbins=int(pl.getargval(argrand, '-b', ['50'])[0])
        , logx=logx, logy=logy
        , xlim=pl.getargval(argrand, '-xlim')
        , ylim=pl.getargval(argrand, '-ylim')
        , legloc=int(pl.getargval(argrand, '-loc', [2])[0])
        , axisfsize=pl.getaxisfsize(argrand))

    lines = p.plt.gca().get_lines()
    for line in lines:
        p.plt.setp(line, markerfacecolor='orange')
    legend = p.plt.legend(argrand['-l'], labelspacing=0.1, numpoints=1)
    p.plt.setp(legend.get_texts(), fontsize=12)

    p.plt.gcf().suptitle('In-degree distribution of scale-free, exponential, and random service networks', fontsize=14)
    p.processplot(p.plt)