Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ax argumentin plot_elpd #1593

Merged
merged 4 commits into from
Mar 5, 2021
Merged

Fix ax argumentin plot_elpd #1593

merged 4 commits into from
Mar 5, 2021

Conversation

agustinaarroyuelo
Copy link
Contributor

@agustinaarroyuelo agustinaarroyuelo commented Mar 2, 2021

Description

plot_elpd can now take the ax argument. Naive example:

d1 = az.load_arviz_data("centered_eight")
d2 = az.load_arviz_data("non_centered_eight")

fig, ax = plt.subplots(1, 2, figsize=(10, 4))

az.plot_elpd({"Centered eight": d1, "Non centered eight": d2}, xlabels=True, ax=ax[0])
az.plot_elpd({"Centered eight": d1, "Non centered eight": d2}, xlabels=True, ax=ax[1])

elpd

Checklist

  • Follows official PR format
  • Includes a sample plot to visually illustrate the changes (only for plot-related functions)
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! the same thing is also needed in line 131 in the case of >2 models being compared, where the ax is an array like in pairplot

@@ -138,6 +140,8 @@ def plot_elpd(
sharey="row",
sharex="all",
)
else:
fig = ax.get_figure()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be ax.ravel()[0] or something like this, because in these cases ax is an array of axes, they should all have the same figure as reference but the array does not know about the figure.

@OriolAbril OriolAbril merged commit fd7b30f into arviz-devs:main Mar 5, 2021
utkarsh-maheshwari pushed a commit to utkarsh-maheshwari/arviz that referenced this pull request May 27, 2021
* fix ax argument

* update changelog

* run black

* fix for ax argument for more than two variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants