tikzplotlib
tikzplotlib copied to clipboard
Clipping image with path
trafficstars
Dear all, I am trying to export an imshow image with a set clip_path. Unfortunately, the latter is ignored. Is there any way to get this functionalitiy working, or am I just doing something wrong? Best, Lars.
Example (with an m x n array of pixels and a patch to clip the image to):
fig, ax = plt.subplots(1, 1, figsize=(3.3,3.3))
bbox=patch.get_extents()
axis.add_patch(patch)
im = axis.imshow(dataArray2D, origin='lower', extent=(bbox.xmin, bbox.xmax, bbox.ymin, bbox.ymax))
im.set_clip_path(patch)
axis.set_axis_off()
tikzplotlib.save("clippedIm.tex")