示例#1
0
def figure3():
    pl.figure(3, figsize=(10, 6))
    pl.clf()
    G = data.my_grid_graph([2, 2])
    for u, v in G.edges():
        G[u][v]['straight_line'] = False

    param = ['\sigma', '\\rho', '\\nu']
    val = [[.25, 1., 2., 4., 8.], [3., 1.5, 1., .75, .5],
           [4., 2., 1.5, 1., .75]]

    for i in range(3):
        for j in range(5):
            params = {}
            if i == 0: params['amp'] = val[i][j]
            if i == 1: params['scale'] = val[i][j]
            if i == 2: params['diff_degree'] = val[i][j]

            if j >= 3:
                params['steps'] = 350  # more detail for the really weird ones

            pl.subplot(3, 5, i * 5 + j + 1)
            graphics.plot_puzzle_graph(G, G.pos, **params)
            pl.axis([-.6, 1.6, -.6, 1.6])
            pl.axis('off')
            pl.text(-.5, 1.5, '$%s = %.2f$' % (param[i], val[i][j]))

    pl.savefig('../tex/fig3.pdf')
    pl.savefig('../fig3.png')
示例#2
0
def figure3():
    pl.figure(3, figsize=(10,6))
    pl.clf()
    G = data.my_grid_graph([2,2])
    for u,v in G.edges():
        G[u][v]['straight_line'] = False

    param = ['\sigma', '\\rho', '\\nu']
    val = [[.25, 1., 2., 4., 8.],
           [3., 1.5, 1., .75, .5],
           [4., 2., 1.5, 1., .75]]

    for i in range(3):
        for j in range(5):
            params = {}
            if i == 0: params['amp'] = val[i][j]
            if i == 1: params['scale'] = val[i][j]
            if i == 2: params['diff_degree'] = val[i][j]

            if j >= 3: params['steps'] = 350  # more detail for the really weird ones

            pl.subplot(3, 5, i*5 + j + 1)
            graphics.plot_puzzle_graph(G, G.pos, **params)
            pl.axis([-.6, 1.6, -.6, 1.6])
            pl.axis('off')
            pl.text(-.5, 1.5, '$%s = %.2f$' % (param[i], val[i][j]))

    pl.savefig('../tex/fig3.pdf')
    pl.savefig('../fig3.png')
示例#3
0
    def test_graphics(self):
        graphics.plot_nub([0,0], [1,0])

        G = data.my_grid_graph([3, 3])
        graphics.plot_puzzle_graph(G, G.pos, diff_degree=1.5)

        graphics.plot_grid_puzzle([3,4], scale=2)

        graphics.plot_grid_puzzle([4,4], amp=1)
示例#4
0
    def test_graphics(self):
        graphics.plot_nub([0, 0], [1, 0])

        G = data.my_grid_graph([3, 3])
        graphics.plot_puzzle_graph(G, G.pos, diff_degree=1.5)

        graphics.plot_grid_puzzle([3, 4], scale=2)

        graphics.plot_grid_puzzle([4, 4], amp=1)