matplotlib.artist.Artist.set_clip_path#

Artist.set_clip_path(path, transform=None)[source]#

设置艺术家的裁剪路径。

参数:
pathPatchPathTransformedPath 或 None

裁剪路径。如果给定一个 Path,则必须同时提供 transform。如果为 None,则移除之前设置的裁剪路径。

transformTransform,可选

仅当 path 是一个 Path 时使用,在这种情况下,给定的 Path 被转换为一个 TransformedPath 使用 transform

备注

为了效率,如果 path 是一个 Rectangle,此方法会将裁剪框设置为对应的矩形,并将裁剪路径设置为 None

出于技术原因(支持 set),一个元组 (path, transform) 也接受为单个位置参数。

使用 matplotlib.artist.Artist.set_clip_path 的示例#

放大镜

放大镜

用补丁裁剪图像

用补丁裁剪图像

绘制图像的多种方式

绘制图像的多种方式

海豚

海豚