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

Incompatibility with plt.subplots(..., sharey=True) #26

Open
sholderbach opened this issue Sep 14, 2022 · 2 comments
Open

Incompatibility with plt.subplots(..., sharey=True) #26

sholderbach opened this issue Sep 14, 2022 · 2 comments

Comments

@sholderbach
Copy link

As the drawcall updates the ylim using the sharey=True setting in matplotlib.pyplot.subplots() is not really useful to compare the weights of different matrices.

MRE:

mtx = logomaker.get_example_matrix('logomaker_logo_matrix')
fig, axs = plt.subplots(2, sharey=True)
logomaker.Logo(mtx * 2, ax=axs[0]) # Require a larger dynamic range
logomaker.Logo(mtx, ax=axs[1]) # ylims are updated to the last displayed range

Output:

grafik

Expected behavior:

If multiple logos with a shared y or x axes are drawn, the range accomodates the largest drawing to allow comparison of the magnitude.


matplotlib version used: 3.5.2

@liliblu
Copy link

liliblu commented Aug 9, 2023

I'm also running into this problem.
I'm getting around it by setting sharey=True, then saving the lowest ymin and highest ymax via ax.get_ylim() for each plot and finally setting ax.set_ylim(ymin, ymax) at the end of creating the figure. Hope that helps you too.

@atareen
Copy link
Collaborator

atareen commented Aug 21, 2023

Thank you @liliblu for the solution!

@sholderbach can you try the above please? If the solution works for you, please close the issue.

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

No branches or pull requests

3 participants