Skip to content

Cleanup psd example. #23426

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 psd example. #23426

wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 14, 2022

  • Show all figures at once.
  • Group axes setter calls to have them take less room relative to the
    psd calls, which are the object of the example.
  • Align the noverlap examples to make the parallelism between them
    clearer.
  • Don't introduce a second random state with a single use.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@@ -57,43 +55,35 @@
y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t)
y = y + np.random.randn(*t.shape)

# Plot the raw time series
# Plot the raw time series.
fig = plt.figure(constrained_layout=True)
gs = gridspec.GridSpec(2, 3, figure=fig)
Copy link
Member

Choose a reason for hiding this comment

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

is there a point to using gridspec here/would mosaic maybe be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched to the more idiomatic add_gridspec, but switching to subplot_mosaic would both result in slightly inconsistent layouts in this subexample relative to all others (unless you make the change in all subexamples) and 2) make the lines below no longer fit in 79 characters. I wouldn't be opposed if you make such a global change across all subexamples of the file, but let's not do this here?

@QuLogic
Copy link
Member

QuLogic commented Jul 14, 2022

This seems good, but I thought we had a discussion about using set over set_*, and I don't know where we landed. Maybe @timhoffm remembers?

- Show all figures at once.
- Group axes setter calls to have them take less room relative to the
  psd calls, which are the object of the example.
- Align the noverlap examples to make the parallelism between them
  clearer.
- Don't introduce a second random state with a single use.
@jklymak
Copy link
Member

jklymak commented Jul 15, 2022

We are trying to deprecate these, so why are we fixing the example?

@anntzer
Copy link
Contributor Author

anntzer commented Jul 15, 2022

We've been talking about deprecating this for a long time and I don't think that'll happen any time soon (though I'd be happy to be proven wrong) so I think in the meantime fix improvements are still useful (unless we decide to "deprecate by removing from the docs", which may be a valid strategy too...).

@timhoffm
Copy link
Member

This seems good, but I thought we had a discussion about using set over set_*, and I don't know where we landed. Maybe @timhoffm remembers?

The status is (#20631 (comment)):

  • set() and set_*() will both be supported, i.e. no deprecations
  • we need better documentation on the concepts - I just read in the above linke I volunteered volunteered to write this 👀
  • we have not decided, whether/where we want to use set() in the docs.

Because of the last point, I would currently not activately switch to set(). Nevertheless, In my eyes it's helpful to switch to set() in many examples where all the set_* are not a central aspect but only added to make the plot look better. - It's less distracting if they are all tucked away in a single call.

@jklymak
Copy link
Member

jklymak commented Jul 17, 2022

We've been talking about deprecating this for a long time and I don't think that'll happen any time soon (though I'd be happy to be proven wrong) so I think in the meantime fix improvements are still useful (unless we decide to "deprecate by removing from the docs", which may be a valid strategy too...).

There is a PR to deprecate it... #22920

@anntzer
Copy link
Contributor Author

anntzer commented Jul 18, 2022

Ah, sorry I missed that. Let's just not bother, then.

@anntzer anntzer closed this Jul 18, 2022
@anntzer anntzer deleted the psd branch July 18, 2022 08:56
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.

5 participants