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 plot_pd function to work with matplotlib 3.8.0 changes #965

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions alibi/explainers/partial_dependence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,10 @@ def _is_categorical(feature):
for ax_group in one_way_axs.values():
min_val = min([ax_pd_lim[0] for _, ax_pd_lim in ax_group])
max_val = max([ax_pd_lim[1] for _, ax_pd_lim in ax_group])
ax_group[0][0].get_shared_y_axes().join(ax_group[0][0], *[ax[0] for ax in ax_group[1:]])
ax_group[0][0].set_ylim(min_val, max_val)
axs = [ax[0] for ax in ax_group]
for ax1, ax2 in zip(axs, axs[1:]):
Copy link
Collaborator

@RobertSamoilescu RobertSamoilescu Sep 19, 2023

Choose a reason for hiding this comment

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

Is the zip necessary? I was thinking of something like:

for ax in axs[1:]:
    ax.sharey(axs[0])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I've changed to your suggestion and tested that it works the same, the code is slightly nicer!

ax1.sharey(ax2)
axs[0].set_ylim(min_val, max_val)

fig.set(**fig_kw)
return axes
Expand Down
Loading