| 6635 | @image_comparison(['pie_linewidth_0.png', 'pie_linewidth_0.png', 'pie_linewidth_0.png'], |
| 6636 | style='mpl20') |
| 6637 | def test_pie_linewidth_0(): |
| 6638 | # The slices will be ordered and plotted counter-clockwise. |
| 6639 | labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' |
| 6640 | sizes = [15, 30, 45, 10] |
| 6641 | colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] |
| 6642 | explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') |
| 6643 | |
| 6644 | plt.pie(sizes, explode=explode, labels=labels, colors=colors, |
| 6645 | autopct='%1.1f%%', shadow=True, startangle=90, |
| 6646 | wedgeprops={'linewidth': 0}) |
| 6647 | # Set aspect ratio to be equal so that pie is drawn as a circle. |
| 6648 | plt.axis('equal') |
| 6649 | |
| 6650 | # Reuse testcase from above for a labeled data test |
| 6651 | data = {"l": labels, "s": sizes, "c": colors, "ex": explode} |
| 6652 | fig = plt.figure() |
| 6653 | ax = fig.gca() |
| 6654 | ax.pie("s", explode="ex", labels="l", colors="c", |
| 6655 | autopct='%1.1f%%', shadow=True, startangle=90, |
| 6656 | wedgeprops={'linewidth': 0}, data=data) |
| 6657 | ax.axis('equal') |
| 6658 | |
| 6659 | # And again to test the pyplot functions which should also be able to be |
| 6660 | # called with a data kwarg |
| 6661 | plt.figure() |
| 6662 | plt.pie("s", explode="ex", labels="l", colors="c", |
| 6663 | autopct='%1.1f%%', shadow=True, startangle=90, |
| 6664 | wedgeprops={'linewidth': 0}, data=data) |
| 6665 | plt.axis('equal') |
| 6666 | |
| 6667 | |
| 6668 | @image_comparison(['pie_center_radius.png'], style='mpl20', |