|
5 | 5 | from numpy.testing import assert_almost_equal, assert_array_equal |
6 | 6 | import pytest |
7 | 7 |
|
8 | | -from matplotlib.patches import Patch, Polygon, Rectangle, FancyArrowPatch |
| 8 | +from matplotlib.patches import (Annulus, Patch, Polygon, Rectangle, |
| 9 | + FancyArrowPatch) |
9 | 10 | from matplotlib.testing.decorators import image_comparison, check_figures_equal |
10 | 11 | from matplotlib.transforms import Bbox |
11 | 12 | import matplotlib.pyplot as plt |
@@ -582,6 +583,18 @@ def test_rotated_arcs(): |
582 | 583 | ax.set_aspect("equal") |
583 | 584 |
|
584 | 585 |
|
| 586 | +@image_comparison(baseline_images=['annulus'], extensions=['png']) |
| 587 | +def test_annulus(): |
| 588 | + |
| 589 | + fig, ax = plt.subplots() |
| 590 | + cir = Annulus((0.5, 0.5), 0.2, 0.05, fc='g') # circular annulus |
| 591 | + ell = Annulus((0.5, 0.5), (0.5, 0.3), 0.1, 45, # elliptical |
| 592 | + fc='m', ec='b', alpha=0.5, hatch='xxx') |
| 593 | + ax.add_patch(cir) |
| 594 | + ax.add_patch(ell) |
| 595 | + ax.set_aspect('equal') |
| 596 | + |
| 597 | + |
585 | 598 | def test_degenerate_polygon(): |
586 | 599 | point = [0, 0] |
587 | 600 | correct_extents = Bbox([point, point]).extents |
@@ -628,14 +641,4 @@ def test_default_joinstyle(): |
628 | 641 | assert patch.get_joinstyle() == 'miter' |
629 | 642 |
|
630 | 643 |
|
631 | | -@image_comparison(baseline_images=['annulus'], extensions=['png']) |
632 | | -def test_annulus(): |
633 | | - from matplotlib.patches import Annulus |
634 | 644 |
|
635 | | - fig, ax = plt.subplots() |
636 | | - cir = Annulus((0.5, 0.5), 0.2, 0.05, fc='g') # circular annulus |
637 | | - ell = Annulus((0.5, 0.5), (0.5, 0.3), 0.1, 45, # elliptical |
638 | | - fc='m', ec='b', alpha=0.5, hatch='xxx') |
639 | | - ax.add_patch(cir) |
640 | | - ax.add_patch(ell) |
641 | | - ax.set_aspect('equal') |
|
0 commit comments