Example #1
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False, subplot=False)
    nt.ok_(fig == fig_old)
    nt.ok_(ax.colNum == 0)
    nt.ok_(ax.rowNum == 0)
    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.ok_(ax1.colNum == 1)
    nt.ok_(ax1.rowNum == 1)
    fig = get_figure(new_fig=True, no_axes=True)
    nt.ok_(type(fig) == plt.Figure)
    fig2, ax2 = get_figure(new_fig=True, subplot=[1, 1, 1])
    nt.ok_(ax2.colNum == 0)
    nt.ok_(ax2.rowNum == 0)
    plt.close('all')
    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False, new_axes=False)
    nt.ok_(fig2 == plt.gcf())
    nt.ok_(ax2 == plt.gca())
    plt.close('all')
Example #2
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False, subplot=False)
    nt.ok_(fig == fig_old)
    nt.ok_(ax.colNum == 0)
    nt.ok_(ax.rowNum == 0)
    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.ok_(ax1.colNum == 1)
    nt.ok_(ax1.rowNum == 1)
    fig = get_figure(new_fig=True, no_axes=True)
    nt.ok_(type(fig) == plt.Figure)
    fig2, ax2 = get_figure(new_fig=True, subplot=[1,1,1])
    nt.ok_(ax2.colNum == 0)
    nt.ok_(ax2.rowNum == 0)
    plt.close('all')
    fig = plt.figure()
    ax  = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False, new_axes=False)
    nt.ok_(fig2 == plt.gcf())
    nt.ok_(ax2 == plt.gca())
    plt.close('all')
Example #3
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False)
    nt.eq_(fig, fig_old)
    nt.eq_(ax.colNum, 0)
    nt.eq_(ax.rowNum, 0)

    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.eq_(ax1.colNum, 1)
    nt.eq_(ax1.rowNum, 1)

    fig2, ax2 = get_figure(new_fig=True, subplot=[1, 1, 1])
    nt.eq_(ax2.colNum, 0)
    nt.eq_(ax2.rowNum, 0)
    plt.close('all')

    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False)
    nt.eq_(fig2, plt.gcf())
    nt.eq_(ax2, plt.gca())
    plt.close('all')
Example #4
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False)
    nt.eq_(fig, fig_old)
    nt.eq_(ax.colNum, 0)
    nt.eq_(ax.rowNum, 0)

    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.eq_(ax1.colNum, 1)
    nt.eq_(ax1.rowNum, 1)

    fig2, ax2 = get_figure(new_fig=True, subplot=[1, 1, 1])
    nt.eq_(ax2.colNum, 0)
    nt.eq_(ax2.rowNum, 0)
    plt.close('all')

    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False)
    nt.eq_(fig2, plt.gcf())
    nt.eq_(ax2, plt.gca())
    plt.close('all')
Example #5
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False)
    assert fig == fig_old
    assert ax.get_subplotspec().colspan.start == 0
    assert ax.get_subplotspec().rowspan.start == 0

    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    assert fig1 != fig_old
    assert ax1.get_subplotspec().colspan.start == 1
    assert ax1.get_subplotspec().rowspan.start == 1

    fig2, ax2 = get_figure(new_fig=True, subplot=[1, 1, 1])
    assert ax2.get_subplotspec().colspan.start == 0
    assert ax2.get_subplotspec().rowspan.start == 0
    plt.close('all')

    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False)
    assert fig2 == plt.gcf()
    assert ax2 == plt.gca()
    plt.close('all')
Example #6
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False)
    nt.eq_(fig, fig_old)
    nt.eq_(ax.get_subplotspec().colspan.start, 0)
    nt.eq_(ax.get_subplotspec().rowspan.start, 0)

    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.eq_(ax1.get_subplotspec().colspan.start, 1)
    nt.eq_(ax1.get_subplotspec().rowspan.start, 1)

    fig2, ax2 = get_figure(new_fig=True, subplot=[1, 1, 1])
    nt.eq_(ax2.get_subplotspec().colspan.start, 0)
    nt.eq_(ax2.get_subplotspec().rowspan.start, 0)
    plt.close('all')

    fig = plt.figure()
    ax = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False)
    nt.eq_(fig2, plt.gcf())
    nt.eq_(ax2, plt.gca())
    plt.close('all')