|
7 | 7 | import matplotlib.pyplot as plt |
8 | 8 | import numpy as np |
9 | 9 |
|
10 | | -# plot |
11 | | -with plt.style.context('cheatsheet_gallery'): |
12 | | - fig, ax = plt.subplots() |
| 10 | +plt.style.use('cheatsheet_gallery') |
| 11 | + |
13 | 12 |
|
14 | | - # make data |
15 | | - X = [1, 2, 3, 4] |
16 | | - colors = np.zeros((len(X), 4)) |
17 | | - colors[:] = mpl.colors.to_rgba("C0") |
18 | | - colors[:, 3] = np.linspace(0.25, 0.75, len(X)) |
| 13 | +# make data |
| 14 | +X = [1, 2, 3, 4] |
| 15 | +colors = np.zeros((len(X), 4)) |
| 16 | +colors[:] = mpl.colors.to_rgba("C0") |
| 17 | +colors[:, 3] = np.linspace(0.25, 0.75, len(X)) |
19 | 18 |
|
20 | | - ax.pie(X, colors=["white"]*len(X), radius=3, center=(4, 4), |
21 | | - wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) |
22 | | - ax.pie(X, colors=colors, radius=3, center=(4, 4), |
23 | | - wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) |
| 19 | +# plot |
| 20 | +fig, ax = plt.subplots() |
| 21 | +ax.pie(X, colors=["white"]*len(X), radius=3, center=(4, 4), |
| 22 | + wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) |
| 23 | +ax.pie(X, colors=colors, radius=3, center=(4, 4), |
| 24 | + wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) |
24 | 25 |
|
25 | | - ax.set_xlim(0, 8) |
26 | | - ax.set_xticks(np.arange(1, 8)) |
27 | | - ax.set_ylim(0, 8) |
28 | | - ax.set_yticks(np.arange(1, 8)) |
| 26 | +ax.set_xlim(0, 8) |
| 27 | +ax.set_xticks(np.arange(1, 8)) |
| 28 | +ax.set_ylim(0, 8) |
| 29 | +ax.set_yticks(np.arange(1, 8)) |
29 | 30 |
|
30 | | - plt.show() |
| 31 | +plt.show() |
0 commit comments