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

Set forward=True by default when setting the figure size #4680

Closed
jhamrick opened this issue Jul 13, 2015 · 14 comments
Closed

Set forward=True by default when setting the figure size #4680

jhamrick opened this issue Jul 13, 2015 · 14 comments
Assignees
Milestone

Comments

@jhamrick
Copy link
Contributor

Original discussion: #4677

It might make more sense to have forward=True by default when calling set_size_inches, so that the bounding box of the figure will automatically update when the figure size is changed.

@tacaswell tacaswell added this to the Color overhaul milestone Jul 14, 2015
@tacaswell
Copy link
Member

👍 on this from me

@jenshnielsen
Copy link
Member

It sounds sensible to me too

@mdboom mdboom modified the milestones: Color overhaul, next major release (2.0) Oct 8, 2015
@mdboom
Copy link
Member

mdboom commented Nov 9, 2015

This will require some extra GUI testing come rc time, but 👍

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Nov 9, 2015
mdboom pushed a commit to mdboom/matplotlib that referenced this issue Nov 11, 2015
mdboom pushed a commit to mdboom/matplotlib that referenced this issue Nov 16, 2015
@mdboom
Copy link
Member

mdboom commented Nov 17, 2015

This seems to cause some sort of feedback loop with TkAgg on Linux (Gnome). If you manually drag the window size, it rapidly changes size in the range around 50 pixels or so from the cursor. Haven't really investigated a fix yet.

@tacaswell
Copy link
Member

The resize callbacks should probably explicitly pass forward=False ?

On Tue, Nov 17, 2015, 17:44 Michael Droettboom notifications@github.com
wrote:

This seems to cause some sort of feedback loop with TkAgg on Linux
(Gnome). If you manually drag the window size, it rapidly changes size in
the range around 50 pixels or so from the cursor. Haven't really
investigated a fix yet.


Reply to this email directly or view it on GitHub
#4680 (comment)
.

@janssen
Copy link

janssen commented Feb 1, 2017

This API change is undocumented. In addition, the forward keyword argument is documented to default to False in the code. And this seems to have broken a number of backends, including the Kivy one.

@tacaswell
Copy link
Member

I'll update the documentation asap.

How did this break kivy?

@tacaswell
Copy link
Member

It looks like that the documentation was in one of the commits referenced here, but got lost in the shuffle, sorry about that. See 0d817d0 for what we changed internally.

@janssen
Copy link

janssen commented Feb 2, 2017

The Kivy backend was originally written against 1.4.3, and it called set_size_inches() to update the size of the figure. But when run against 2.0.0 (and I think 1.5.x), it resulted in a comical quantized shrinking of the window to nothing. Because the new and hidden "forward=True" (which by the way seems ill-advised to me) was causing a call to FigureManagerBase.resize() which resized the window, which triggered a resize of the canvas, which caused a call to set_size_inches(), which...

@tacaswell
Copy link
Member

#8008 adds documentation for this.

The reason for this change is so that you can do fig.set_size_inches(h, w) at the interactive prompt and have it do the right thing.

Sorry we broke things, but at least this one is easy to fix!

@janssen
Copy link

janssen commented Feb 2, 2017

Yes, I understand the reasoning. I just think that setting the figure size and setting the window size are different enough not to be automatically conflated. I could see a config variable you could set to explicitly make that linkage, though.

@jkjk822
Copy link

jkjk822 commented Oct 30, 2017

Is this change only in 2.1? 2.0 and older don't reflect this change: http://matplotlib.org/2.0.0/api/figure_api.html#matplotlib.figure.Figure.set_size_inches

Also it is very confusing that the default is still foward=False for set_figheight and set_figwidth, can this be changed?

@tacaswell
Copy link
Member

@jkjk822
Copy link

jkjk822 commented Oct 30, 2017

@tacaswell Oh I see, thanks!

What about the second point? Any plans to make the behavior consistent for set_figheight and set_figwidth? I could open a new issue if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants