Skip to content

Commit 7d6ae97

Browse files
committed
Added test for frame and center arguments on ax.pie()
1 parent 0899015 commit 7d6ae97

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,6 +3343,33 @@ def test_pie_ccw_true():
33433343
# Set aspect ratio to be equal so that pie is drawn as a circle.
33443344
plt.axis('equal')
33453345

3346+
3347+
@image_comparison(baseline_images=['pie_frame_grid'], extensions=['png'])
3348+
def test_pie_frame_grid():
3349+
# The slices will be ordered and plotted counter-clockwise.
3350+
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
3351+
sizes = [15, 30, 45, 10]
3352+
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
3353+
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
3354+
3355+
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
3356+
autopct='%1.1f%%', shadow=True, startangle=90,
3357+
wedgeprops={'linewidth': 0},
3358+
frame=True, center = (2,2) )
3359+
3360+
plt.pie(sizes[::-1], explode=explode, labels=labels, colors=colors,
3361+
autopct='%1.1f%%', shadow=True, startangle=90,
3362+
wedgeprops={'linewidth': 0},
3363+
frame=True, center = (5,2) )
3364+
3365+
plt.pie(sizes, explode=explode[::-1], labels=labels, colors=colors,
3366+
autopct='%1.1f%%', shadow=True, startangle=90,
3367+
wedgeprops={'linewidth': 0},
3368+
frame=True, center = (3,5) )
3369+
# Set aspect ratio to be equal so that pie is drawn as a circle.
3370+
plt.axis('equal')
3371+
3372+
33463373
@cleanup
33473374
def test_margins():
33483375
# test all ways margins can be called

0 commit comments

Comments
 (0)