-
Notifications
You must be signed in to change notification settings - Fork 227
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
Changing fig.set_size_inches() interactively shrinks the figure/canvas #239
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem Description
I am trying to create a figure and subsequently change it using interactive input. Specifically, I would like to change the number of subplot axes based on the input. The following code works as expected:
The output looks like this, while the additional axes are added/removed as expected based on the interaction with the slider, and the size of the figure remains constant throughout:
However, I would like to keep the absolute size of the "main axes" constant, while changing the overall size of the figure based on the number of "additional axes." I was hoping I'd achieve that by removing the
figsize
setting from the initialplt.subplots()
call and then settingfig.set_size_inches()
based on the interactive input, as follows:When the cell is run for the first time, the resulting figure looks identical to the one above. However, when the slider is changed, now the output canvas suddenly shrinks ~2-fold, as follows:
What is interesting is that the underlying figure seems to be the correct size but the canvas is what shrinks. Additionally, the size of the canvas is proportionate to the size of the underlying figure - i.e., it does respond to changes in the interactive input (height increases a little with slider number increasing, while the width is constant), but is just smaller.
The moment I interactively pull the right lower corner of the canvas with my mouse, the figure resizes to fit the canvas.
Note: This issue may be related to the following issues: #117, #36, and especially #17 (due to my impression that the output shrinks proportionately by ~2x and I am using a high-dpi diplay), though because there's no loop involved, it seems to be caused by
fig.set_size_inches()
, and none of the solutions suggested in the issues above worked, I decided to open a separate issue.Versions
The text was updated successfully, but these errors were encountered: