()
| 243 | |
| 244 | @image_comparison(['clip_to_bbox.png'], style='mpl20') |
| 245 | def test_clip_to_bbox(): |
| 246 | fig, ax = plt.subplots() |
| 247 | ax.set_xlim([-18, 20]) |
| 248 | ax.set_ylim([-150, 100]) |
| 249 | |
| 250 | path = mpath.Path.unit_regular_star(8).deepcopy() |
| 251 | path.vertices *= [10, 100] |
| 252 | path.vertices -= [5, 25] |
| 253 | |
| 254 | path2 = mpath.Path.unit_circle().deepcopy() |
| 255 | path2.vertices *= [10, 100] |
| 256 | path2.vertices += [10, -25] |
| 257 | |
| 258 | combined = mpath.Path.make_compound_path(path, path2) |
| 259 | |
| 260 | patch = mpatches.PathPatch( |
| 261 | combined, alpha=0.5, facecolor='coral', edgecolor='none') |
| 262 | ax.add_patch(patch) |
| 263 | |
| 264 | bbox = mtransforms.Bbox([[-12, -77.5], [50, -110]]) |
| 265 | result_path = combined.clip_to_bbox(bbox) |
| 266 | result_patch = mpatches.PathPatch( |
| 267 | result_path, alpha=0.5, facecolor='green', lw=4, edgecolor='black') |
| 268 | |
| 269 | ax.add_patch(result_patch) |
| 270 | |
| 271 | |
| 272 | @image_comparison(['patch_alpha_coloring'], remove_text=True, style='_classic_test') |
nothing calls this directly
no test coverage detected
searching dependent graphs…