-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Modified restrictions on margins
method
#9459
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
Modified restrictions on margins
method
#9459
Conversation
ax3.margins(x=1, y=0.5) | ||
assert ax3.margins() == (1, 0.5) | ||
ax3.margins(x=-0.2, y=0.5) | ||
assert ax3.margins() == (-0.2, 0.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these tests would be better if they also asserted the x-lim and y-lim you expect. i.e. assert ax3.get_xlim() == (left, right)
. That way if anyone monkeys with the internal code this test will catch the inconsistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed 76a2721.
Please trigger rebuild for circleci. |
You’ll need to merge the upstream master with your branch. Basically follow the instructions at https://help.github.com/articles/syncing-a-fork/ but where they tell you to checkout master you will checkout flexible-axis-margins. Then push back to github. |
Who ever merges this please squash-merge to get rid of the merge from master (or @AtharvaKhare can you rebase this on to current master?). |
@AtharvaKhare we can squash-merge if you like. This makes your 6 commits look like one commit and makes the matplotlib commit history much cleaner. If you'd like yet another bit of git-fu, you can Then you need to There are many guides to this online. http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html. I sometimes screw it up. A good idea is to make a backup of your repository, then you can start again if you need to. If you have trouble just ask. This is kind of an optipnal step on your part, but I think "Squash and merge" from our end is risky in case of conflicts... [as an aside, none of this is actually in our development docs. It might be reasonable to add a short guide outlining the basic git workflows] |
It was in our development docs for a while and then was removed by updating gitwash, see matthew-brett/gitwash#13 |
examples/axes_grid1/axes_margins.py
Outdated
============ | ||
Margins demo | ||
============ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a small paragraph explaining what the example does?
The title is also not very informative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind if I push some changes directly to the branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go ahead.
Axes.set_xmargin and Axes.set_ymargin methods now take values greater than -0.5. Margins greater than 0 zoom out and margins between -0.5 and 0 zoom in. Modified `lib/matplotlib/test/test_axes.py::test_margins` to reflect the changed method. Added an example for `Axes.margins` at `example/axes_grid1/axes_margins.py`.
@tacaswell Ah OK, it is indeed at http://matplotlib.org/devel/gitwash/development_workflow.html I admit that I find the heading "Working with Matplotlib source code" a bit obscure and didn't think to check there on a quick skim. I'd have said "Using git and github with Matplotlib source code". |
I've extended a bit the documentation of this example, and moved it outside of the axis_gris1 example folder (which is specifically for the toolkit axes_grid1) and into the pyplot_examples. |
@NelleV Thank you! |
PR Summary
Modified and added example for
matplotlib.axes.Axes.margins()
.Fixes #9334.
PR Checklist