Skip to content

Replace random values by hard-coded numbers in plot-types ... #25797

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
May 1, 2023

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented May 1, 2023

... for the cases where we have only very few random numbers. This makes the code a bit simpler, because we do not have to seed. Also, a list of hard-coded numbers is slightly simpler to grasp compared to a rng function.

The values are chosen so that the figures look approximately the same as before.

This is partly also in anticipation of the switch to numpy's rng generator classes (related: #25765). While conceptually superior, they are a bit more verbose and introduce the additional local variable rng (IMHO this is the benefit and the downside: It explicitly ties the rng state to the local context -> clarity. But OTOH the user is bothered with this local state even if it's not important to them - like in our examples.)

... for the cases where we have only very few random numbers.
This makes the code a bit simpler, because we do not have to
seed. Also, a list of hard-coded numbers is slightly simpler to
grasp compared to a rng function. This is partly also in
anticipation of the switch to numpy's rng generator classes.
While conceptually superior, they are a bit more verbose and
introduce the additional local variable `rng` (IMHO this is the
benefit and the downside: It explicitly ties the rng state to
the local context -> clarity. But OTOH the user is bothered
with this local state even if it's not important to them - like
in our examples.)
@story645 story645 added this to the v3.7-doc milestone May 1, 2023
@timhoffm timhoffm merged commit 89452ce into matplotlib:main May 1, 2023
@timhoffm timhoffm deleted the plot-types-data branch May 1, 2023 22:36
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 1, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 1, 2023
QuLogic added a commit that referenced this pull request May 2, 2023
…797-on-v3.7.x

Backport PR #25797 on branch v3.7.x (Replace random values by hard-coded numbers in plot-types ...)
QuLogic added a commit that referenced this pull request May 2, 2023
…797-on-v3.7.1-doc

Backport PR #25797 on branch v3.7.1-doc (Replace random values by hard-coded numbers in plot-types ...)
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