Skip to content

Use ax.set() for a more compact notation of styling in plot types docs #19882

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 1 commit into from
Apr 7, 2021

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Apr 6, 2021

No description provided.

@timhoffm timhoffm added this to the v3.5.0 milestone Apr 6, 2021
Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

Yay, even better since I think this is the perfect place to demo ax.set

@jklymak
Copy link
Member

jklymak commented Apr 6, 2021

Are we hoping ax.set will be canonical? I agree these have a lot of manual fiddling, but I don't usually do that much manual fiddling, and therefore ax.set is usually more effort than its worth...

@timhoffm
Copy link
Member Author

timhoffm commented Apr 6, 2021

Are we hoping ax.set will be canonical?

That's a conversation to have (and depends on the meaning of "canoncial").

IMHO:

  • ax.set cannot replace all ax.set_* methods because it can only handle one parameter and some of the setters have more optional ones.
  • ax.set should be regarded as a shortcut. It's easier to read and less to type compared to all the boilerplate ax.set_.
  • Originally, I'd been skeptical on ax.set (i) because it's redundant (ii) because it's not discoverable. For (i) I have now the position, that readability tops "there should only be one way" in this case. (ii) should become better with Better document Axes.set() #19884.

@QuLogic QuLogic merged commit 17947d1 into matplotlib:master Apr 7, 2021
@timhoffm timhoffm deleted the doc-plot-types branch April 7, 2021 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants