Skip to content

Commit

Permalink
DOC: Switch nested pie example from cmaps to color_sequences
Browse files Browse the repository at this point in the history
This makes it clearer that we are just indexing into a list of colors. Calling cmaps with an integer argument is somewhat obscure and we want to move away from this. See also matplotlib#28198.
  • Loading branch information
timhoffm committed Nov 11, 2024
1 parent 38a8e15 commit d732d1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions galleries/examples/pie_and_polar_charts/nested_pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
size = 0.3
vals = np.array([[60., 32.], [37., 40.], [29., 10.]])

cmap = plt.colormaps["tab20c"]
outer_colors = cmap(np.arange(3)*4)
inner_colors = cmap([1, 2, 5, 6, 9, 10])
tab20c = plt.color_sequences["tab20c"]
outer_colors = [tab20c[i] for i in [0, 4, 8]]
inner_colors = [tab20c[i] for i in [1, 2, 5, 6, 9, 10]]

ax.pie(vals.sum(axis=1), radius=1, colors=outer_colors,
wedgeprops=dict(width=size, edgecolor='w'))
Expand Down

0 comments on commit d732d1f

Please sign in to comment.