Skip to content

Commit

Permalink
Fix xlabels and ax argument in plot_elpd (#1601)
Browse files Browse the repository at this point in the history
* fix ax argument for numvars > 2 and xlabels

* update changelog

* fix xlabels
  • Loading branch information
agustinaarroyuelo authored Mar 26, 2021
1 parent e0a7da6 commit 8a1fd2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Fix `from_numpyro` crash when importing model with `thinning=x` for `x > 1` ([1619](https://github.com/arviz-devs/arviz/pull/1619))
* Upload updated mypy.ini in ci if mypy copilot fails ([1624](https://github.com/arviz-devs/arviz/pull/1624))
* Added type checking to raise an error whenever `InferenceData` object is passed using `io_pymc3`'s `trace` argument ([1629](https://github.com/arviz-devs/arviz/pull/1629))
* Fix `xlabels` in `plot_elpd` ([1601](https://github.com/arviz-devs/arviz/pull/1601))

### Deprecation
* Deprecated `index_origin` and `order` arguments in `az.summary` ([1201](https://github.com/arviz-devs/arviz/pull/1201))
Expand Down
7 changes: 4 additions & 3 deletions arviz/plots/backends/matplotlib/elpdplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def plot_elpd(
squeeze=False,
constrained_layout=not xlabels,
sharey="row",
sharex="all",
sharex="col",
)
else:
fig = ax.get_figure()
fig = ax.ravel()[0].get_figure()

for i in range(0, numvars - 1):
var1 = pointwise_data[i]
Expand Down Expand Up @@ -179,7 +179,8 @@ def plot_elpd(
"{} - {}".format(models[i], models[j + 1]), fontsize=titlesize, wrap=True
)
if xlabels:
set_xticklabels(ax[-1, -1], coord_labels)
for i in range(len(ax)):
set_xticklabels(ax[-1, i], coord_labels)
fig.autofmt_xdate()
fig.tight_layout()
if legend:
Expand Down

0 comments on commit 8a1fd2c

Please sign in to comment.