Exemple #1
0
def test_probplot_beta_dist_best_fit_x(plot_data):
    fig, (ax1, ax2) = plt.subplots(nrows=2)
    dist = stats.beta(3, 3)
    fig = viz.probplot(
        plot_data,
        dist=dist,
        ax=ax1,
        problabel="Beta scale",
        bestfit=True,
        datascale="log",
        probax="x",
    )
    ax1.set_xlim(left=0.5, right=98)

    fig = viz.probplot(
        plot_data,
        ax=ax2,
        problabel="Default (norm)",
        bestfit=True,
        datascale="log",
        probax="x",
        estimate_ci=True,
    )
    ax2.set_xlim(left=0.5, right=98)

    assert isinstance(fig, plt.Figure)
    return fig
Exemple #2
0
def test_probplot_beta_dist_best_fit_y(plot_data):
    fig, (ax1, ax2) = plt.subplots(ncols=2)
    dist = stats.beta(3, 3)
    fig = viz.probplot(plot_data, dist=dist, ax=ax1, problabel='Beta scale',
                       bestfit=True, datascale='log', probax='y')
    ax1.set_ylim(bottom=0.5, top=98)

    fig = viz.probplot(plot_data, ax=ax2, datalabel='Default (norm)',
                       bestfit=True, datascale='log', probax='y',
                       estimate_ci=True)
    ax2.set_ylim(bottom=0.5, top=98)

    assert isinstance(fig, plt.Figure)
    return fig
Exemple #3
0
def test_probplot_beta_dist_best_fit_x(plot_data):
    fig, (ax1, ax2) = plt.subplots(nrows=2)
    dist = stats.beta(3, 3)
    fig = viz.probplot(plot_data, dist=dist, ax=ax1, problabel='Beta scale',
                       bestfit=True, datascale='log', probax='x')
    ax1.set_xlim(left=0.5, right=98)

    fig = viz.probplot(plot_data, ax=ax2, problabel='Default (norm)',
                       bestfit=True, datascale='log', probax='x',
                       estimate_ci=True)
    ax2.set_xlim(left=0.5, right=98)

    assert isinstance(fig, plt.Figure)
    return fig
Exemple #4
0
def test_probplot_qq_dist(plot_data):
    fig, ax = plt.subplots()
    norm = stats.norm(*stats.norm.fit(plot_data))
    fig = viz.probplot(
        plot_data, ax=ax, plottype="qq", dist=norm, datalabel="Test label"
    )
    return fig
Exemple #5
0
def test_probplot_pp(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = dict(color='b', linestyle='--', markeredgecolor='g', markerfacecolor='none')
    fig = viz.probplot(plot_data, ax=ax, plottype='pp', datascale='linear',
                       datalabel='test x', problabel='test y',
                       scatter_kws=scatter_kws)
    return fig
Exemple #6
0
def test_probplot_prob_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(
        plot_data, ax=ax, datalabel="Test xlabel", datascale="log", probax="y"
    )
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #7
0
def test_probplot_test_results():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    fig, results = viz.probplot(data, return_results=True)

    nt.assert_true(isinstance(results, dict))
    known_keys = sorted(['q', 'x', 'y', 'xhat', 'yhat', 'res'])
    nt.assert_list_equal(sorted(list(results.keys())), known_keys)
Exemple #8
0
def test_probplot_test_results(plot_data):
    fig, ax = plt.subplots()
    fig, results = viz.probplot(plot_data, return_best_fit_results=True)

    assert isinstance(results, dict)
    known_keys = sorted(["q", "x", "y", "xhat", "yhat", "res"])
    assert sorted(list(results.keys())) == known_keys
    return fig
Exemple #9
0
def test_probplot_color_and_label(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data,
                       ax=ax,
                       color='pink',
                       label='A Top-Level Label')
    ax.legend(loc='lower right')
    return fig
Exemple #10
0
def test_probplot_test_results(plot_data):
    fig, ax = plt.subplots()
    fig, results = viz.probplot(plot_data, return_best_fit_results=True)

    assert isinstance(results, dict)
    known_keys = sorted(['q', 'x', 'y', 'xhat', 'yhat', 'res'])
    assert sorted(list(results.keys())) == known_keys
    return fig
Exemple #11
0
def test_probplot_pp_bestfit_probax_y(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = {'marker': 's', 'color': 'red'}
    line_kws = {'linestyle': '--', 'linewidth': 3}
    fig = viz.probplot(plot_data, ax=ax, plottype='pp', datascale='linear', probax='y',
                       datalabel='test x', bestfit=True, problabel='test y',
                       scatter_kws=scatter_kws, line_kws=line_kws, estimate_ci=True)
    return fig
Exemple #12
0
def test_probplot_prob(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data,
                       ax=ax,
                       problabel='Test xlabel',
                       datascale='log')
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #13
0
def test_probplot_test_results(plot_data):
    fig, ax = plt.subplots()
    fig, results = viz.probplot(plot_data, return_best_fit_results=True)

    assert isinstance(results, dict)
    known_keys = sorted(['q', 'x', 'y', 'xhat', 'yhat', 'res'])
    assert sorted(list(results.keys())) == known_keys
    return fig
Exemple #14
0
def test_probplot_pp_bestfit_probax_y():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    scatter_kws = {'marker': 's', 'color': 'red'}
    line_kws = {'linestyle': '--', 'linewidth': 3}
    fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear', probax='y',
                       xlabel='test x', bestfit=True, ylabel='test y',
                       scatter_kws=scatter_kws, line_kws=line_kws)
Exemple #15
0
def test_probplot_qq(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data,
                       ax=ax,
                       plottype='qq',
                       datalabel='Test label',
                       datascale='log',
                       scatter_kws=dict(color='r'))
    return fig
Exemple #16
0
def test_probplot_qq_bestfit(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data,
                       ax=ax,
                       plottype='qq',
                       bestfit=True,
                       problabel='Test label',
                       datascale='log',
                       estimate_ci=True)
    return fig
Exemple #17
0
def test_probplot_prob_bestfit(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data,
                       ax=ax,
                       datalabel='Test xlabel',
                       bestfit=True,
                       datascale='log',
                       estimate_ci=True)
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #18
0
def test_probplot_qq(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(
        plot_data,
        ax=ax,
        plottype="qq",
        datalabel="Test label",
        datascale="log",
        scatter_kws=dict(color="r"),
    )
    return fig
Exemple #19
0
def test_probplot_qq_bestfit(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(
        plot_data,
        ax=ax,
        plottype="qq",
        bestfit=True,
        problabel="Test label",
        datascale="log",
        estimate_ci=True,
    )
    return fig
Exemple #20
0
def test_probplot_prob_bestfit_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(
        plot_data,
        ax=ax,
        datalabel="Test xlabel",
        bestfit=True,
        datascale="log",
        probax="y",
        estimate_ci=True,
    )
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #21
0
def test_probplot_prob_bestfit_exceedance(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(
        plot_data,
        ax=ax,
        datalabel="Test xlabel",
        bestfit=True,
        datascale="log",
        estimate_ci=True,
        pp_kws={"exceedance": True},
    )
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #22
0
def test_probplot_pp(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = dict(color='b',
                       linestyle='--',
                       markeredgecolor='g',
                       markerfacecolor='none')
    fig = viz.probplot(plot_data,
                       ax=ax,
                       plottype='pp',
                       datascale='linear',
                       datalabel='test x',
                       problabel='test y',
                       scatter_kws=scatter_kws)
    return fig
Exemple #23
0
def test_probplot_beta_dist_best_fit_y(plot_data):
    fig, (ax1, ax2) = plt.subplots(ncols=2)
    dist = stats.beta(3, 3)
    fig = viz.probplot(plot_data,
                       dist=dist,
                       ax=ax1,
                       problabel='Beta scale',
                       bestfit=True,
                       datascale='log',
                       probax='y')
    ax1.set_ylim(bottom=0.5, top=98)

    fig = viz.probplot(plot_data,
                       ax=ax2,
                       datalabel='Default (norm)',
                       bestfit=True,
                       datascale='log',
                       probax='y',
                       estimate_ci=True)
    ax2.set_ylim(bottom=0.5, top=98)

    assert isinstance(fig, plt.Figure)
    return fig
Exemple #24
0
def test_probplot_pp_bestfit(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = {'marker': 's', 'color': 'red'}
    line_kws = {'linestyle': '--', 'linewidth': 3}
    fig = viz.probplot(plot_data,
                       ax=ax,
                       plottype='pp',
                       datascale='linear',
                       datalabel='test x',
                       bestfit=True,
                       problabel='test y',
                       scatter_kws=scatter_kws,
                       line_kws=line_kws,
                       estimate_ci=True)
    return fig
Exemple #25
0
def test_probplot_pp(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = dict(
        color="b", linestyle="--", markeredgecolor="g", markerfacecolor="none"
    )
    fig = viz.probplot(
        plot_data,
        ax=ax,
        plottype="pp",
        datascale="linear",
        datalabel="test x",
        problabel="test y",
        scatter_kws=scatter_kws,
    )
    return fig
Exemple #26
0
def test_probplot_pp_bestfit(plot_data):
    fig, ax = plt.subplots()
    scatter_kws = {"marker": "s", "color": "red"}
    line_kws = {"linestyle": "--", "linewidth": 3}
    fig = viz.probplot(
        plot_data,
        ax=ax,
        plottype="pp",
        datascale="linear",
        datalabel="test x",
        bestfit=True,
        problabel="test y",
        scatter_kws=scatter_kws,
        line_kws=line_kws,
        estimate_ci=True,
    )
    return fig
Exemple #27
0
def test_probplot_qq_bestfit_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, plottype='qq', bestfit=True, problabel='Test label',
                       datascale='log', probax='y', estimate_ci=True)
    return fig
Exemple #28
0
def test_probplot_prob_bestfit_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, datalabel='Test xlabel', bestfit=True,
                       datascale='log', probax='y', estimate_ci=True)
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #29
0
def test_probplot_qq_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, plottype='qq', problabel='Test label', probax='y',
                       datascale='log', scatter_kws=dict(color='r'))
    return fig
Exemple #30
0
def test_probplot_prob_probax_y(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, datalabel='Test xlabel', datascale='log', probax='y')
    assert isinstance(fig, plt.Figure)
    return fig
Exemple #31
0
def test_probplot_color_and_label(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, color="pink", label="A Top-Level Label")
    ax.legend(loc="lower right")
    return fig
Exemple #32
0
def test_probplot_qq_bestfit_probax_y():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    fig = viz.probplot(data, ax=ax, axtype='qq', bestfit=True, ylabel='Test label', otherscale='log', probax='y')
Exemple #33
0
def test_probplot_prob_bestfit_probax_y():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', bestfit=True, otherscale='log', probax='y')
    nt.assert_true(isinstance(fig, plt.Figure))
Exemple #34
0
def test_probplot_qq_dist(plot_data):
    fig, ax = plt.subplots()
    norm = stats.norm(*stats.norm.fit(plot_data))
    fig = viz.probplot(plot_data, ax=ax, plottype='qq', dist=norm,
                       datalabel='Test label')
    return fig
Exemple #35
0
def test_probplot_pp_probax_y():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    scatter_kws = dict(color='b', linestyle='--', markeredgecolor='g', markerfacecolor='none')
    fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear', probax='y',
                       xlabel='test x', ylabel='test y', scatter_kws=scatter_kws)
Exemple #36
0
def test_probplot_color_and_label(plot_data):
    fig, ax = plt.subplots()
    fig = viz.probplot(plot_data, ax=ax, color='pink', label='A Top-Level Label')
    ax.legend(loc='lower right')
    return fig
Exemple #37
0
def test_probplot_qq_probax_y():
    fig, ax = plt.subplots()
    data = setup_plot_data()
    fig = viz.probplot(data, ax=ax, axtype='qq', ylabel='Test label', probax='y',
                       otherscale='log', scatter_kws=dict(color='r'))