diff --git a/examples/text_labels_and_annotations/autowrap.py b/examples/text_labels_and_annotations/autowrap.py index cfd583d1d072..ec8ffd623514 100644 --- a/examples/text_labels_and_annotations/autowrap.py +++ b/examples/text_labels_and_annotations/autowrap.py @@ -5,6 +5,13 @@ Matplotlib can wrap text automatically, but if it's too long, the text will be displayed slightly outside of the boundaries of the axis anyways. + +Note: Auto-wrapping does not work together with +``savefig(..., bbox_inches='tight')``. The 'tight' setting rescales the canvas +to accommodate all content and happens before wrapping. This affects +``%matplotlib inline`` in IPython and Jupyter notebooks where the inline +setting uses ``bbox_inches='tight'`` by default when saving the image to +embed. """ import matplotlib.pyplot as plt diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index c4815d8b9380..c272dfc7858d 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -544,6 +544,14 @@ def set_wrap(self, wrap): Parameters ---------- wrap : bool + + Notes + ----- + Wrapping does not work together with + ``savefig(..., bbox_inches='tight')`` (which is also used internally + by ``%matplotlib inline`` in IPython/Jupyter). The 'tight' setting + rescales the canvas to accommodate all content and happens before + wrapping. """ self._wrap = wrap