X Tutup
Skip to content

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

Merged
tacaswell merged 2 commits intomatplotlib:masterfrom
afvincent:fix_psd_demo3
Jul 28, 2016
Merged

DOC: Switch to OO code style & ensure fixed y-range in psd_demo3#6841
tacaswell merged 2 commits intomatplotlib:masterfrom
afvincent:fix_psd_demo3

Conversation

@afvincent
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

X Tutup