Skip to content

Commit

Permalink
Fix credible interval percentage in plot loo pit legend (#1745)
Browse files Browse the repository at this point in the history
* Fix percentage in loo pit legend

* Updated CHANGELOG
  • Loading branch information
Rishabh261998 authored Jul 26, 2021
1 parent 86e06d8 commit 56aab58
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* Fixed plot_kde to take labels with kwargs. ([1710](https://github.com/arviz-devs/arviz/pull/1710))
* Fixed xarray related tests. ([1726](https://github.com/arviz-devs/arviz/pull/1726))
* Fix Bokeh deprecation warnings ([1657](https://github.com/arviz-devs/arviz/pull/1657))
* Fix credible inteval percentage in legend in `plot_loo_pit` ([1745](https://github.com/arviz-devs/arviz/pull/1745))

### Deprecation
* Deprecated `index_origin` and `order` arguments in `az.summary` ([1201](https://github.com/arviz-devs/arviz/pull/1201))
Expand Down
4 changes: 3 additions & 1 deletion arviz/plots/backends/bokeh/loopitplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def plot_loo_pit(
fill_kwargs.setdefault(
"step", "mid" if plot_kwargs["drawstyle"] == "steps-mid" else None
)
fill_kwargs.setdefault("legend_label", "{:.3g}% credible interval".format(hdi_prob))
fill_kwargs.setdefault(
"legend_label", "{:.3g}% credible interval".format(hdi_prob * 100)
)
elif use_hdi:
if hdi_kwargs is None:
hdi_kwargs = {}
Expand Down
4 changes: 2 additions & 2 deletions arviz/plots/backends/matplotlib/loopitplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def plot_loo_pit(
fill_kwargs.setdefault(
"step", "mid" if plot_kwargs["drawstyle"] == "steps-mid" else None
)
fill_kwargs.setdefault("label", "{:.3g}% credible interval".format(hdi_prob))
fill_kwargs.setdefault("label", "{:.3g}% credible interval".format(hdi_prob * 100))
elif use_hdi:
if hdi_kwargs is None:
hdi_kwargs = {}
Expand Down Expand Up @@ -137,7 +137,7 @@ def plot_loo_pit(
ax.tick_params(labelsize=xt_labelsize)
if legend:
if not (use_hdi or (ecdf and ecdf_fill)):
label = "{:.3g}% credible interval".format(hdi_prob) if ecdf else "Uniform"
label = "{:.3g}% credible interval".format(hdi_prob * 100) if ecdf else "Uniform"
ax.plot([], label=label, **plot_unif_kwargs)
ax.legend()

Expand Down

0 comments on commit 56aab58

Please sign in to comment.