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

Skip to content

Commit b7ce415

Browse files
authored
Merge pull request #20499 from timhoffm/plot-types-pie
Simplify plot types pie()
2 parents 90a91b1 + 4faac38 commit b7ce415

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

plot_types/basic/pie.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
See `~matplotlib.axes.Axes.pie`.
77
"""
8-
import matplotlib as mpl
98
import matplotlib.pyplot as plt
109
import numpy as np
1110

@@ -14,16 +13,12 @@
1413

1514
# make data
1615
X = [1, 2, 3, 4]
17-
colors = np.zeros((len(X), 4))
18-
colors[:] = mpl.colors.to_rgba("C0")
19-
colors[:, 3] = np.linspace(0.25, 0.75, len(X))
16+
colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(X)))
2017

2118
# plot
2219
fig, ax = plt.subplots()
23-
ax.pie(X, colors=["white"]*len(X), radius=3, center=(4, 4),
24-
wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)
2520
ax.pie(X, colors=colors, radius=3, center=(4, 4),
26-
wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)
21+
wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)
2722

2823
ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
2924
ylim=(0, 8), yticks=np.arange(1, 8))

0 commit comments

Comments
 (0)