Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cleanup examples #20631

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

Closed
wants to merge 1 commit into from
Closed

Cleanup examples #20631

wants to merge 1 commit into from

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Jul 11, 2021

@timhoffm timhoffm force-pushed the cleanup-examples branch 3 times, most recently from 42282fc to 269ed42 Compare July 12, 2021 06:41
@timhoffm timhoffm force-pushed the cleanup-examples branch 3 times, most recently from 2addc5b to b677c24 Compare July 12, 2021 21:31
@jklymak
Copy link
Member

jklymak commented Jul 12, 2021

Is this something we want to do this pervasively? I never use ax.set, though I suppose I could get in the habit, but I'm not sure if I think its good style or not. It certainly does not tab-complete because the arguments are just **kwargs. (Sorry for the noise if this was a decision already decided on)

@timhoffm
Copy link
Member Author

You are right, we did not have a formal decision on this. Maybe we should.

At least we have that API and we should consider if it's something that should be promoted.
I find batch-setting worthwile. Kwargs often used in more modern plot tools. Personally, I find the compact notation better than having lots of ax.set_* calls.

It certainly does not tab-complete because the arguments are just **kwargs.

It now does after #20569.

@story645
Copy link
Member

Is this something we want to do this pervasively?

I feel like for the docs it's less confusing if properties are set in a consistent way across examples where the property setting isn't the point, and shoving the property setting into a function helps make it kinda of go away.

@jklymak
Copy link
Member

jklymak commented Jul 14, 2021

I think that the docs should reflect users' typical use cases, and every axis should have a label. So sure, for highly technical docs where we are doing something completely orthogonal, doing the more mysterious thing is OK. I'm not horrified by ax.set(xlabel='my xlabel', ylabel='my ylabel') but

  1. it is not as flexible (you can't pass any of the optional kwargs),
  2. it is not as intuitive to explain to new users,
  3. it is not as searchable (either in the docs or on the internet), and
  4. it does not tab complete the same way as ax.set_x... does.

I think the only thing it has going for it is that it is (usually) shorter and can be written in one line.

So I'm pretty skeptical of removing it very often or deciding that it is the "preferred" way, if nothing else because of 1. maybe folks can talk about it at the meeting this week (I'll be away, but I'm sure you understand the concerns).

@timhoffm timhoffm marked this pull request as draft July 15, 2021 20:49
@timhoffm
Copy link
Member Author

We had some discussion about this in the dev call (which was only a small group today). The overall consensus is that both the explicit setter functions as well as the batch-set have their merits and are targeted at different use cases / user groups. Ideally, they would be separate API-levels, but that's not the case for historic reasons. It is important to communicate the reasons for both concepts and when to use what. I'll write a tutorial on that, which hopefully gives an understanding and clear directions. Until that's agreed on, I put this PR on hold.

@timhoffm
Copy link
Member Author

Let's close this. If we want to pick this up at some point, starting anew will be easier than trying to rebase.

@timhoffm timhoffm closed this May 18, 2023
@timhoffm timhoffm deleted the cleanup-examples branch July 19, 2024 11:35
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.

3 participants