| 6745 | |
| 6746 | @image_comparison(['pie_rotatelabels_true.png'], style='mpl20') |
| 6747 | def test_pie_rotatelabels_true(): |
| 6748 | # The slices will be ordered and plotted counter-clockwise. |
| 6749 | labels = 'Hogwarts', 'Frogs', 'Dogs', 'Logs' |
| 6750 | sizes = [15, 30, 45, 10] |
| 6751 | colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] |
| 6752 | explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') |
| 6753 | |
| 6754 | plt.pie(sizes, explode=explode, labels=labels, colors=colors, |
| 6755 | autopct='%1.1f%%', shadow=True, startangle=90, |
| 6756 | rotatelabels=True) |
| 6757 | # Set aspect ratio to be equal so that pie is drawn as a circle. |
| 6758 | plt.axis('equal') |
| 6759 | |
| 6760 | |
| 6761 | @image_comparison(['pie_no_label.png'], style='mpl20') |