def test_multiple_functions():
    fig, ax, sliders = interactive_plot([f1, f2],
                                        x=x,
                                        tau=tau,
                                        beta=beta,
                                        display=False)
    _ = plt.legend()
    return fig
示例#2
0
def test_styling():
    fig, ax = plt.subplots()
    controls = interactive_plot(
        x,
        f1,
        beta=beta,
        tau=tau,
        label="f1",
    )
    iplt.title("the value of tau is: {tau:.2f}", controls=controls["tau"])
    interactive_plot(
        x,
        f2,
        controls=controls,
        label="custom label!",
        linestyle="--",
    )
    plt.legend()
    return fig
def test_styling():
    fig, ax, controls = interactive_plot(
        [f1, f2],
        x=x,
        beta=beta,
        tau=tau,
        plot_kwargs=[{}, {
            "label": "custom label!",
            "linestyle": "--"
        }],
        title="the value of tau is: {tau:.2f}",
    )
    plt.legend()
    return fig
示例#4
0
def test_mixed_types():
    if not mpl_gr_32:
        pytest.skip("wonky font differences")

    def foo(x, **kwargs):
        return x

    x = np.linspace(0, 1)
    a = np.linspace(0, 10)
    b = (0, 10, 15)
    # set order is determined in part by PYTHONHASHSEED
    # but there doesn't seem to be an easy way to set this for pytest
    # so the unordered set will change its order from test to test :/
    # c = {'this', 'set will be', 'unordered'}
    d = {("this", "set will be", "ordered")}
    e = 0  # this will not get a slider

    # can't test ipywidgets yet
    # no mpl widgets for booleans
    # f = widgets.Checkbox(value=True, description='A checkbox!!')
    return interactive_plot(x, foo, a=a, b=b, d=d, e=e, display=False).control_figures[0]
示例#5
0
def test_multiple_functions():
    fig, ax = plt.subplots()
    controls = interactive_plot(x, f1, tau=tau, beta=beta, label="f1")
    interactive_plot(x, f2, controls=controls, label="f2")
    _ = plt.legend()
    return fig