diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf new file mode 100644 index 000000000000..c702c926aad7 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png new file mode 100644 index 000000000000..ed474046d505 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg new file mode 100644 index 000000000000..8f70e2942303 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight_raster.svg @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/test_bbox_tight.py b/lib/matplotlib/tests/test_bbox_tight.py index b0041a24fdd7..881b1e52bcec 100644 --- a/lib/matplotlib/tests/test_bbox_tight.py +++ b/lib/matplotlib/tests/test_bbox_tight.py @@ -84,7 +84,15 @@ def test_bbox_inches_tight_clipping(): path.vertices *= 0.25 patch.set_clip_path(path, transform=ax.transAxes) plt.gcf().artists.append(patch) - + + +@image_comparison(baseline_images=['bbox_inches_tight_raster'], + remove_text=True, savefig_kwarg={'bbox_inches': 'tight'}) +def test_bbox_inches_tight_raster(): + """Test rasterization with tight_layout""" + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot([1.0, 2.0], rasterized=True) if __name__ == '__main__': import nose diff --git a/lib/matplotlib/tight_bbox.py b/lib/matplotlib/tight_bbox.py index f98a6bc10369..69ff23abf426 100644 --- a/lib/matplotlib/tight_bbox.py +++ b/lib/matplotlib/tight_bbox.py @@ -83,6 +83,6 @@ def process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None): bbox_inches, restore_bbox = bbox_inches_restore restore_bbox() - r = adjust_bbox(figure, bbox_inches, fixed_dpi) + r = adjust_bbox(fig, bbox_inches, fixed_dpi) return bbox_inches, r