X Tutup
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@
# Plot directive configuration
# ----------------------------

plot_pre_code = '''
# Default imports from plot_directive sphinx extension.
import numpy as np
from matplotlib import pyplot as plt

# Initialize random number generator for consistent plots.
import random
random.seed(20021210)
del random
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the point of importing random, then deleting random, then using np.random?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't know for certain whether any of our examples use random, but I don't think np.random shares seed with it. I delete it because our documentation already mysteriously depends on np and plt existing and I don't want anyone else to start depending on random, too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That doesn't do anything. It fixes the seed for the stdlib random generator, but not numpy's.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right, which is why there's a line just underneath setting numpy's seed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so once #7385 is merged, you can get rid of these three lines.

np.random.seed(20021210)
'''

plot_formats = [('png', 100), ('pdf', 100)]

# Subdirectories in 'examples/' directory of package and titles for gallery
Expand Down
X Tutup