-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Doc: add axes titles to axhspan/axvspan #28677
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Side note, maybe not enough to change in hindsight, but to set future practice:
I would generally favor
set_thing(x)
overset(thing=x)
for single properties.And in this particular example, I would also have kept the two properties
ax1.set(ylim=(-1.5, 1.5), title="axhspan")
above separate. Mainly because of symmetry withax2.set_title
and to a lesser degree because ylim and title are quite different properties.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'm the opposite in that I prefer .set for properties that aren't the focus of the example and we don't need any of the other kwargs, mostly b/c so many folks complain "why must I write all this boilerplate" and this is less boilerplate.
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.
Axes.set()
is similar topyplot
. It's a convenience interface that people can use to simplify their code - if they know what they are doing, but it does not provide the full capability. I'd say: If you only want to learn or teach the minimal stuff, stick withset_*()
. Only when it's a real simplification, useset()
. - Possibly this is something we should discuss and agree on a strategy, like wie did with Axes-interface vs. pyplot. It's not helpful if the docs do it one way or the other depending on the author.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.
Looked up if we did in the meeting notes and agreeing that first step is probably writing a user guide entry:
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.
Thanks for digging that up 🚀. I'm sure I advocated for "advertise
set()
more". But I don't agree withThat's not the criterion for me. Instead, I would like to advertise
set()
as a shortcut. As API lead I see the need and call for a discussion on how we consider and in which cases we want to advertiseset()
.Uh oh!
There was an error while loading. Please reload this page.
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'm fine w/ a new discussion and then us documenting the decision at https://matplotlib.org/devdocs/devel/style_guide.html#terminology, please add it to the agenda for a week you'll be on the call or maybe open an issue? (we really need a consistent way to do not call based/asynch discussions)
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.
The set_title method is far more featureful and should usually be preferred to set(title=) unless there is some reason to be concise. Using nonstandard patterns trips up reading an example and I don't think there is a strong argument to use "set" as a standard.
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.
My reasons for conciseness were:
That being said:
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.
Yes, but none of those features are needed for this example and if someone needs those features they can look at one of our set_title examples?
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.
Discussion moved to #28693