matplotlib._tight_bbox
用于Figure.savefig
中*bbox_inches*参数的辅助模块。
-
matplotlib._tight_bbox.adjust_bbox(fig, bbox_inches, fixed_dpi=None)[source]
临时调整图形,以便只保存指定区域(bbox_inches)。
它会修改 fig.bbox、fig.bbox_inches、fig.transFigure._boxout 和 fig.patch。虽然图形大小会改变,但原始图形的比例得以保留。函数返回一个用于恢复原始值的函数。
-
matplotlib._tight_bbox.process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None)[source]
当图形DPI在绘图过程中(例如,栅格化)改变时需要调用的函数。它会恢复bbox并根据新的DPI重新调整。