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
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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')
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))
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
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)
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'))