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

Restore toolbar for tiled plots #379

Merged
merged 3 commits into from
Sep 25, 2024
Merged

Restore toolbar for tiled plots #379

merged 3 commits into from
Sep 25, 2024

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented Sep 24, 2024

Fixes 2 cases:

  1. When making tiled plots using the %matplotlib widget backend, the toolbar would disappear.
import plopp as pp
%matplotlib widget

f = pp.data.data1d().plot()
f / f
  1. Toolbar would also be absent when making figures using custom axes, e.g.:
import plopp as pp
import matplotlib.pyplot as plt
%matplotlib widget

fig, ax = plt.subplots(2, 1)
f1 = pp.data.data1d().plot(ax=ax[0])
f2 = pp.data.data2d().plot(ax=ax[1])
fig.canvas

The fix is to not alter the visibility of the toolbar if axes come from the outside world.

Note that this does mean that if you do something like

fig, ax = plt.subplots(2, 1)
f = pp.data.data1d().plot(ax=ax[0])
f

you will see 'double' toolbar, but usually if one supplies the ax argument, it implies that we want to use the matplotlib figure instead of the Plopp figure.

@nvaytet nvaytet marked this pull request as draft September 25, 2024 08:52
@nvaytet
Copy link
Member Author

nvaytet commented Sep 25, 2024

Changing to draft as #378 needs to be merged first.

@nvaytet nvaytet marked this pull request as ready for review September 25, 2024 13:32
@nvaytet nvaytet merged commit 56ae40d into main Sep 25, 2024
4 checks passed
@nvaytet nvaytet deleted the restore-toolbar-tiled branch September 25, 2024 13:39
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