Skip to content

Commit

Permalink
ensure interpolation for plot_hpd always works (#1039)
Browse files Browse the repository at this point in the history
* ensure interpolation for plot_hpd always works

* update changelog
  • Loading branch information
aloctavodia authored Feb 4, 2020
1 parent 19c5dc5 commit 034dd14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Violinplot: fix histogram (#997)
* Convert all instances of SyntaxWarning to UserWarning (#1016)
* Fix `point_estimate` in `plot_posterior` (#1038)
* Fix interpolation `hpd_plot` (#1039)

### Deprecation

Expand Down
3 changes: 2 additions & 1 deletion arviz/plots/hpdplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def plot_hpd(
smooth_kwargs = {}
smooth_kwargs.setdefault("window_length", 55)
smooth_kwargs.setdefault("polyorder", 2)
x_data = np.linspace(x.min(), x.max(), 200)
eps = np.finfo(float).eps
x_data = np.linspace(x.min() + eps, x.max() - eps, 200)
hpd_interp = griddata(x, hpd_, x_data)
y_data = savgol_filter(hpd_interp, axis=0, **smooth_kwargs)
else:
Expand Down

0 comments on commit 034dd14

Please sign in to comment.