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

Skip to content

Commit a9a0251

Browse files
committed
DOC: Remove randomness from tight layout demo.
1 parent 093c819 commit a9a0251

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

examples/pylab_examples/demo_tight_layout.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11

22
import matplotlib.pyplot as plt
3+
import itertools
34
import warnings
45

5-
import random
6-
fontsizes = [8, 16, 24, 32]
6+
7+
fontsizes = itertools.cycle([8, 16, 24, 32])
78

89

910
def example_plot(ax):
1011
ax.plot([1, 2])
11-
ax.set_xlabel('x-label', fontsize=random.choice(fontsizes))
12-
ax.set_ylabel('y-label', fontsize=random.choice(fontsizes))
13-
ax.set_title('Title', fontsize=random.choice(fontsizes))
12+
ax.set_xlabel('x-label', fontsize=next(fontsizes))
13+
ax.set_ylabel('y-label', fontsize=next(fontsizes))
14+
ax.set_title('Title', fontsize=next(fontsizes))
15+
1416

1517
fig, ax = plt.subplots()
1618
example_plot(ax)

0 commit comments

Comments
 (0)