src.utils.crop_axes_region module

src.utils.crop_axes_region module#

src.utils.crop_axes_region.crop_axes_region(ax, xmin, xmax, ymin, ymax, pad_pixels=0, dpi=500)[source]#

Crop a specified data region from a matplotlib Axes and return it as a PIL.Image.

Parameters:
  • axmatplotlib.axes.Axes object.

  • xmin – Data-coordinate bounds.

  • xmax – Data-coordinate bounds.

  • ymin – Data-coordinate bounds.

  • ymax – Data-coordinate bounds.

  • pad_pixels – Inward pixel padding to avoid border artifacts.

Returns:

PIL.Image object.