Skip to content

Commit eb3cf4f

Browse files
committed
add test
1 parent 6e7bfef commit eb3cf4f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4740,6 +4740,20 @@ def test_pie_rotatelabels_true():
47404740
plt.axis('equal')
47414741

47424742

4743+
@image_comparison(baseline_images=['pie_no_label'], extensions=['png'])
4744+
def test_pie_nolabel_but_legend():
4745+
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
4746+
sizes = [15, 30, 45, 10]
4747+
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
4748+
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
4749+
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
4750+
autopct='%1.1f%%', shadow=True, startangle=90, labeldistance=None,
4751+
rotatelabels=True)
4752+
plt.axis('equal')
4753+
plt.ylim(-1.2, 1.2)
4754+
plt.legend()
4755+
4756+
47434757
def test_pie_textprops():
47444758
data = [23, 34, 45]
47454759
labels = ["Long name 1", "Long name 2", "Long name 3"]

0 commit comments

Comments
 (0)