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

Skip to content

DOC: Switch to OO code style & ensure fixed y-range in psd_demo3 #6841

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 2 commits into from
Jul 28, 2016

Conversation

afvincent
Copy link
Contributor

In psd_demo3.py pylab example:

  • adopt OO code style;
  • fix the y-range to avoid discrepancies between the two subplots in the case of y-values in the 1st subplot that exceed the provided y-tick range (due to an “unfortunate” random draw) .

@efiring
Copy link
Member

efiring commented Jul 26, 2016

All examples such as this one that use random data should first call np.random.seed(1) (or some unsigned integer value) so that the data will be repeatable.

@afvincent
Copy link
Contributor Author

@efiring I agree with you: the example now uses a dedicated RandomState instance as prng. I think this approach is still readable (np.random becoming simply prng here) and it avoids messing with the default prng np.random.

It is part of my plans to try to introduce this kind of reproducible (pseudo-)random draws in the relevant mpl examples (but I do not really have the bandwidth currently…)

@tacaswell tacaswell merged commit 58a4173 into matplotlib:master Jul 28, 2016
tacaswell added a commit that referenced this pull request Jul 28, 2016
DOC: Switch to OO code style & ensure fixed y-range in `psd_demo3`
@tacaswell
Copy link
Member

backported to v2.x as a5fe337

@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Jul 28, 2016
@afvincent afvincent deleted the fix_psd_demo3 branch July 28, 2016 07:24
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