Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Include outward ticks in bounding box #5683
Conversation
mdboom
added the
needs_review
label
Dec 15, 2015
|
This needs a test specifically of tight layout on outward ticks, but I thought I'd put this up for comment early anyway... |
mdboom
added this to the
next major release (2.0)
milestone
Dec 15, 2015
|
I think you meant this replaces #5502? |
Oops. You're right. |
|
Well, I don't see anything particularly wrong with it, but are there no test images that use outward ticks? Or just none with a tight bounding box? |
|
A test has been added |
WeatherGod
commented on the diff
Dec 16, 2015
| @@ -567,7 +567,11 @@ def get_window_extent(self, *args, **kwargs): | ||
| get the axes bounding box in display space; *args* and | ||
| *kwargs* are empty | ||
| """ | ||
| - return self.bbox | ||
| + bbox = self.bbox | ||
| + x_pad = self.xaxis.get_tick_padding() | ||
| + y_pad = self.yaxis.get_tick_padding() | ||
| + return mtransforms.Bbox([[bbox.x0 - x_pad, bbox.y0 - y_pad], | ||
| + [bbox.x1 + x_pad, bbox.y1 + y_pad]]) |
WeatherGod
Member
|
|
image tests that have just been added are failing |
|
I don't think the test is really all that useful. tight_layout is for ensuring that subplots don't run into each other. So, a good test would be to have a grid of subplots, perhaps each with different tick directions? |
|
@WeatherGod: I've updated the test as you helpfully suggested. |
tacaswell
and 1 other
commented on an outdated diff
Dec 17, 2015
tacaswell
and 2 others
commented on an outdated diff
Dec 17, 2015
| @@ -1097,6 +1108,9 @@ def get_tightbbox(self, renderer): | ||
| else: | ||
| return None | ||
| + def get_tick_padding(self): | ||
| + return self.majorTicks[0].get_tick_padding() |
tacaswell
Owner
|
|
I've addressed @tacaswell's comments, and added minor ticks to the test to catch the pathological case he mentions. |
|
Also updated to handle the case where there are no ticks, as suggested by @WeatherGod |
tacaswell
added a commit
that referenced
this pull request
Dec 19, 2015
|
|
tacaswell |
08fc864
|
tacaswell
merged commit 08fc864
into matplotlib:master
Dec 19, 2015
tacaswell
removed the
needs_review
label
Dec 19, 2015
|
backported as 2a6bb26 |
tacaswell
added a commit
that referenced
this pull request
Dec 19, 2015
|
|
tacaswell |
2a6bb26
|
tacaswell
added a commit
that referenced
this pull request
Dec 19, 2015
|
|
tacaswell |
8ac5b4b
|
This was referenced Jan 18, 2016
|
Backport to v2.x was actually via 8ac5b4b. |
mdboom commentedDec 15, 2015
Replaces #5502.