|
11 | 11 | n = 12 |
12 | 12 | X = np.arange(n) |
13 | 13 | rng = np.random.default_rng() |
14 | | -Y1 = (1 - X / float(n)) * rng.uniform(0.5, 1.0, n) |
15 | | -Y2 = (1 - X / float(n)) * rng.uniform(0.5, 1.0, n) |
| 14 | +Y1 = (1 - X / n) * rng.uniform(0.5, 1.0, n) |
| 15 | +Y2 = (1 - X / n) * rng.uniform(0.5, 1.0, n) |
16 | 16 |
|
17 | 17 | plt.axes((0.025, 0.025, 0.95, 0.95)) |
18 | 18 | plt.bar(X, +Y1, facecolor="#9999ff", edgecolor="white") |
19 | 19 | plt.bar(X, -Y2, facecolor="#ff9999", edgecolor="white") |
20 | 20 |
|
21 | | -for x, y in zip(X, Y1, strict=True): |
22 | | - plt.text(x + 0.4, y + 0.05, f"{y:.2f}", ha="center", va="bottom") |
| 21 | +for x, y in zip(X, Y1): |
| 22 | + plt.text(x, y + 0.05, f"{y:.2f}", ha="center", va="bottom") |
23 | 23 |
|
24 | | -for x, y in zip(X, Y2, strict=True): |
25 | | - plt.text(x + 0.4, -y - 0.05, f"{y:.2f}", ha="center", va="top") |
| 24 | +for x, y in zip(X, Y2): |
| 25 | + plt.text(x, -y - 0.05, f"{y:.2f}", ha="center", va="top") |
26 | 26 |
|
27 | 27 | plt.xlim(-0.5, n) |
28 | 28 | plt.xticks([]) |
|
0 commit comments