Example #1
0
def test_plot_legend():
    fig1, ax1 = plot_legend(fig, ax)
    legend = ax1.get_legend()
    nt.ok_(legend is None)
    fig1, ax1 = plot_legend(fig, ax, no_legend=False)
    legend = ax1.get_legend()
    nt.ok_(legend.get_texts()[0].get_text() == 'test')
Example #2
0
def test_plot_legend():
    fig1, ax1 = plot_legend(fig, ax)
    legend = ax1.get_legend()
    nt.ok_(legend is None)
    fig1, ax1 = plot_legend(fig, ax, no_legend=False)
    legend = ax1.get_legend()
    nt.ok_(legend.get_texts()[0].get_text() == 'test')
Example #3
0
def test_plot_legend():
    with get_fig_2d() as (fig, ax):
        plot_legend(ax)
        legend = ax.get_legend()
        nt.ok_(legend is None)

    with get_fig_2d() as (fig, ax):
        ax.plot([1, 2, 3], [1, 2, 3], label='line 1')
        plot_legend(ax, no_legend=False)
        legend = ax.get_legend()
        nt.eq_(legend.get_texts()[0].get_text(), 'line 1')
Example #4
0
def test_plot_legend():
    with get_fig_2d() as (fig, ax):
        plot_legend(ax)
        legend = ax.get_legend()
        nt.ok_(legend is None)

    with get_fig_2d() as (fig, ax):
        ax.plot([1, 2, 3], [1, 2, 3], label='line 1')
        plot_legend(ax, no_legend=False)
        legend = ax.get_legend()
        nt.eq_(legend.get_texts()[0].get_text(), 'line 1')
Example #5
0
def test_plot_legend(get_fig_2d):
    fig, ax = get_fig_2d
    plot_legend(ax)
    legend = ax.get_legend()
    assert legend is None

    fig, ax = get_fig_2d
    ax.plot([1, 2, 3], [1, 2, 3], label='line 1')
    plot_legend(ax, no_legend=False)
    legend = ax.get_legend()
    assert legend.get_texts()[0].get_text() == 'line 1'