-
Notifications
You must be signed in to change notification settings - Fork 224
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
Implement default position/box for legend #359
Conversation
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'd actually like to get the wider @GenericMappingTools/python team's opinion on this, since upstream GMT has a default auto-legend placement already and we're overriding it here . It would certainly be nice from a PyGMT user's perspective not to have to pass in anything to fig.legend()
.
I actually wonder if we can skip having to call fig.legend()
altogether and have fig.show()
return the automatic legend somehow. Not sure if there's a way to implement this here, or if it can be an upstream GMT change. Thoughts?
I am in favor of keeping the explicit call to |
Well the Zen of Python does have an "explicit is better than implicit" clause. Let's require users to call
Yes you're right, maybe move it to a separate PR. Will be a good time to learn how to git cherrypick! |
Ugh. I ran into the limits of my git / GitHub knowledge here trying to remove the commits from this branch that I cherry-picked for #371. Not sure what to do now... |
...and I lost my commit by merging with master. Yikes. I've deleted the now-useless branch. If this is something we want to re-open, let me know how to proceed. Sorry! |
Ouch, hang on there, I'll see if I can find a way to recover the deleted branch. There's actually a git command to do that Edit: I take that back @liamtoney, try running References: |
The |
Okay, the implementation is more robust now I think. |
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.
Good job on the branch recovery @liamtoney, you're definitely picking up things fast! Just a few more comments/questions.
Co-Authored-By: Wei Ji <[email protected]>
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 this looks good to go. Could you change the title to indicate that there's a default box
setting as well? I'll merge this in after that, and maybe wait a few hours in case anyone has any last minute objections.
@weiji14 I think we're ready to merge! |
Description of proposed changes
This sets the
position
argument offigure.legend()
to default toJTR+jTR
, i.e. upper-right inside of the plot. The motivation is convenience for quick plotting so folks don't have to remember alignment syntax etc.Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.