You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tight_layout puts axes title below twiny xlabel #5474
I know it maybe annoying to users, but I am currently much more worried about regressions (ie things we broke between 1.4.3 and 1.5.0) than long standing bugs.
This is going to be a tough one to solve. Technically speaking, there is no
bug here. tight_layout() is doing exactly what it is supposed to do. The
problem is that the xlabel text object has a position relative to the
x-axis, while the title has a position defined relative to the edge of the
subplot region. These two positions are only loosely related to each other,
and there is certainly no constraint system in place to enforce relative
positions from each other.
I know it maybe annoying to users, but I am currently much more worried
about regressions (ie things we broke between 1.4.3 and 1.5.0) than
long standing bugs.
—
Reply to this email directly or view it on GitHub #5474 (comment)
.
This is wrapped up in the fact that we need a layout engine. There was a
prototype using a linear constraint solver a while ago, but the hard part
is going to be (automatically?) generating the constraints.
This is going to be a tough one to solve. Technically speaking, there is no
bug here. tight_layout() is doing exactly what it is supposed to do. The
problem is that the xlabel text object has a position relative to the
x-axis, while the title has a position defined relative to the edge of the
subplot region. These two positions are only loosely related to each other,
and there is certainly no constraint system in place to enforce relative
positions from each other.
I know it maybe annoying to users, but I am currently much more worried
about regressions (ie things we broke between 1.4.3 and 1.5.0) than
long standing bugs.
—
Reply to this email directly or view it on GitHub
< #5474 (comment)
.
—
Reply to this email directly or view it on GitHub #5474 (comment)
.
Re: "I suspect the problem here is that the title is attached to the first axes, but the axis label is attached to the twin."
Actually not, if you move the first axes' xlabel and xticks to top (gca().xaxis.set_{label,ticks}_position("top")) you suffer from the same problem.
@tacaswell The hard are not the constraits, that mostly busy-work. The hard part
is including it in a backwards compatible way. Also there is still the same chicken-egg problem which
is also faced by tight_layout that some variables are only known after drawn (labelsizes, ticklabelsizes).
OK, I got twinx/twiny to work, but it doesn't fix this problem because #9082 doesn't handle things below the axes level, and title placement etc is handled at a level below that.
I'll note that this problem is much more simple than this makes it seem, and has nothing to do with twiny other than twiny puts the xlabel at the top. And it has absolutely nothing to do w/ tight_layout.
I'm just saying tight_layout and twiny are red-herrings; the real problem is that title doesn't care/know that there is an x-axis right there.
A geometry manager at the sub-axes level would be great too, and probably manageable for xlabel, ylabel, and title. Once we get into tick labels and ticks themselves things get hairy. And some seem to think layout managers would be good for placing legends, etc around data. That hurts my head. Not saying its not all possible, but just getting subplot placement sorted out was tough, and that should be the easy job...
Activity
tacaswell commentedon Nov 13, 2015
Is this a regression from 1.4.3?
tacaswell commentedon Nov 13, 2015
I suspect the problem here is that the title is attached to the first axes, but the axis label is attached to the twin.
anntzer commentedon Nov 13, 2015
1.4.3 suffers from the same issue.
tacaswell commentedon Nov 13, 2015
I know it maybe annoying to users, but I am currently much more worried about regressions (ie things we broke between 1.4.3 and 1.5.0) than long standing bugs.
WeatherGod commentedon Nov 13, 2015
This is going to be a tough one to solve. Technically speaking, there is no
bug here. tight_layout() is doing exactly what it is supposed to do. The
problem is that the xlabel text object has a position relative to the
x-axis, while the title has a position defined relative to the edge of the
subplot region. These two positions are only loosely related to each other,
and there is certainly no constraint system in place to enforce relative
positions from each other.
On Thu, Nov 12, 2015 at 10:06 PM, Thomas A Caswell <notifications@github.com
tacaswell commentedon Nov 13, 2015
This is wrapped up in the fact that we need a layout engine. There was a
prototype using a linear constraint solver a while ago, but the hard part
is going to be (automatically?) generating the constraints.
On Fri, Nov 13, 2015 at 9:33 AM Benjamin Root notifications@github.com
wrote:
anntzer commentedon Nov 13, 2015
Re: "I suspect the problem here is that the title is attached to the first axes, but the axis label is attached to the twin."
Actually not, if you move the first axes' xlabel and xticks to top (
gca().xaxis.set_{label,ticks}_position("top")) you suffer from the same problem.Tillsten commentedon Nov 17, 2015
@tacaswell The hard are not the constraits, that mostly busy-work. The hard part
is including it in a backwards compatible way. Also there is still the same chicken-egg problem which
is also faced by tight_layout that some variables are only known after drawn (labelsizes, ticklabelsizes).
anntzer commentedon Oct 20, 2017
@jklymak Sorry I ended up not having much time so far to look at your geometry manager PR, but perhaps this issue may be of interest for you...
jklymak commentedon Oct 21, 2017
I've not dared look at
twinx/twinyyet, but if they are rationally constructed then this shouldn't be very hard.jklymak commentedon Oct 21, 2017
OK, I got
twinx/twinyto work, but it doesn't fix this problem because #9082 doesn't handle things below the axes level, and title placement etc is handled at a level below that.I'll note that this problem is much more simple than this makes it seem, and has nothing to do with
twinyother thantwinyputs the xlabel at the top. And it has absolutely nothing to do w/tight_layout.anntzer commentedon Oct 21, 2017
Well, I actually did need labels both on top and on bottom (for separate axes).
jklymak commentedon Oct 21, 2017
Sure, its still an issue.
I'm just saying
tight_layoutandtwinyare red-herrings; the real problem is that title doesn't care/know that there is an x-axis right there.A geometry manager at the sub-axes level would be great too, and probably manageable for xlabel, ylabel, and title. Once we get into tick labels and ticks themselves things get hairy. And some seem to think layout managers would be good for placing legends, etc around data. That hurts my head. Not saying its not all possible, but just getting subplot placement sorted out was tough, and that should be the easy job...
jklymak commentedon Oct 21, 2017
Closing as a duplicate of #1415