|
12 | 12 | import matplotlib.transforms as mtransforms
|
13 | 13 | import matplotlib.collections as mcollections
|
14 | 14 | import matplotlib.artist as martist
|
15 |
| -from matplotlib.testing.decorators import image_comparison |
| 15 | +from matplotlib.testing.decorators import check_figures_equal, image_comparison |
16 | 16 |
|
17 | 17 |
|
18 | 18 | def test_patch_transform_of_none():
|
@@ -121,6 +121,25 @@ def test_clipping():
|
121 | 121 | ax1.set_ylim([-3, 3])
|
122 | 122 |
|
123 | 123 |
|
| 124 | +@check_figures_equal(extensions=['png']) |
| 125 | +def test_clipping_zoom(fig_test, fig_ref): |
| 126 | + # This test places the Axes and sets its limits such that the clip path is |
| 127 | + # outside the figure entirely. This should not break the clip path. |
| 128 | + ax_test = fig_test.add_axes([0, 0, 1, 1]) |
| 129 | + l, = ax_test.plot([-3, 3], [-3, 3]) |
| 130 | + # Explicit Path instead of a Rectangle uses clip path processing, instead |
| 131 | + # of a clip box optimization. |
| 132 | + p = mpath.Path([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]) |
| 133 | + p = mpatches.PathPatch(p, transform=ax_test.transData) |
| 134 | + l.set_clip_path(p) |
| 135 | + |
| 136 | + ax_ref = fig_ref.add_axes([0, 0, 1, 1]) |
| 137 | + ax_ref.plot([-3, 3], [-3, 3]) |
| 138 | + |
| 139 | + ax_ref.set(xlim=(0.5, 0.75), ylim=(0.5, 0.75)) |
| 140 | + ax_test.set(xlim=(0.5, 0.75), ylim=(0.5, 0.75)) |
| 141 | + |
| 142 | + |
124 | 143 | def test_cull_markers():
|
125 | 144 | x = np.random.random(20000)
|
126 | 145 | y = np.random.random(20000)
|
|
0 commit comments