Skip to content

Sticky margins #7476

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

Merged
merged 20 commits into from
Dec 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove extraneous stale setting; fix indent.
  • Loading branch information
anntzer committed Dec 3, 2016
commit 360dba71f6f3518ed6ed1e360a312bcd6fa06cec
8 changes: 4 additions & 4 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5804,10 +5804,10 @@ def pcolorfast(self, *args, **kwargs):

if style == "image":
im = mimage.AxesImage(self, cmap, norm,
interpolation='nearest',
origin='lower',
extent=(xl, xr, yb, yt),
**kwargs)
interpolation='nearest',
origin='lower',
extent=(xl, xr, yb, yt),
**kwargs)
im.set_data(C)
im.set_alpha(alpha)
elif style == "pcolorimage":
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ def use_sticky_edges(self):
@use_sticky_edges.setter
def use_sticky_edges(self, b):
self._use_sticky_edges = bool(b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also re-trigger an auto-scaling?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about that also, but decided against it. I could be convinced otherwise for now, but long term I think we might want to consolidate the autoscaling at draw time instead of having calls to autoscale_view sprinkled all over the place. I don't think it makes sense to trigger autoscaling with every change in the state of the plot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am convinced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need the axes as stale? This won't have an effect until the next autoscaling, which should also mark it as stale, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. You are welcome to replace it with a comment to that effect. I think I put the call in because we tend to have it in every function that potentially changes how the plot will look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, together with indentation fix below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I agree with this, if as Eric suggests above we move towards autoscaling a draw time (as late as possible) then marking the figure as stale will trigger a re-draw (and hence the re-autoscaling).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
On the other hand this is easy enough to revert when we do switch to draw-time autoscaling (which makes complete sense).

self.stale = True
# No effect until next autoscaling, which will mark the axes as stale.

def set_xmargin(self, m):
"""
Expand Down