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

Excessive white space / margins with some plots. #586

Open
asteppke opened this issue Jan 16, 2025 · 0 comments
Open

Excessive white space / margins with some plots. #586

asteppke opened this issue Jan 16, 2025 · 0 comments

Comments

@asteppke
Copy link

asteppke commented Jan 16, 2025

With the current ipympl 0.9.6 (and probably earlier versions) I am observing excessive white space around axes in some cases when using the %matplotlib ipympl mode but not in the %matplotlib inline mode.

A small example to reproduce:

%matplotlib ipympl
from matplotlib import pyplot as plt

fig, ax = plt.subplots(figsize=(5, 3), constrained_layout=True)
ax.imshow([[1,2,3],[4,5,6],[7,8,9]])
ax.set_aspect(0.1)

This yields:

Image

And the same example in inline mode:

%matplotlib inline
from matplotlib import pyplot as plt

fig, ax = plt.subplots(figsize=(5, 3), constrained_layout=True)
ax.imshow([[1,2,3],[4,5,6],[7,8,9]])
ax.set_aspect(0.1)

Image

Especially larger figures then became unmanageable in the ipympl backend. Setting constrained_layout or using plt.tight_layout() does not seem to influence the margins. Can this behavior be influenced?

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

1 participant