Honour the random state a plot was given - #1120
Merged
Merged
Conversation
Define one conversion boundary for integer seeds and use it for jitter. Existing generators and `None` remain unchanged. Callers can therefore normalise stored parameters once when several draws must advance one stream.
Drawing an unseeded `geom_sina` stored NumPy's `random` module in the plot parameters. Copying the plot then raised `TypeError: cannot pickle 'module' object`. Preserve the unset state until drawing needs NumPy's global random generator.
`position_jitter` and `position_jitterdodge` created a new generator for each axis. A fixed seed therefore produced identical horizontal and vertical offsets, placing points along a diagonal. They also treated zero as an absent seed. Initialise one generator during setup so both axes draw from the same advancing stream and zero remains valid.
`stat_summary` and `stat_summary_bin` treated `random_state=0` as absent and drew from NumPy's global random state. Preserve zero so repeated summaries use the same seeded stream.
`random_state` parameters now accept NumPy `Generator` instances in addition to integer seeds and `RandomState` instances. Bootstrap summaries draw sample indices through the generator interface. Other randomised operations use its shared sampling methods.
The `&` and `*` operators copied each broadcast layer shallowly. Mutable parameters resolved while drawing one plot were then visible to the others. Give every target plot an independent copy so each plot draws from its own layer state.
Document support for NumPy `Generator` instances, valid zero seeds, independent axis jitter, copyable unseeded Sina plots, and isolated broadcast layers in compositions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1115