8000 Annotations get cropped out of figures saved with bbox_inches='tight' · Issue #12699 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Annotations get cropped out of figures saved with bbox_inches='tight' #12699
Closed
@jooh

Description

@jooh

Bug report

Bug summary

Annotations get cropped when saving figures with bbox_inches='tight'.

Code for reproduction

import matplotlib.pyplot as plt
# from https://matplotlib.org/gallery/text_labels_and_annotations/demo_annotation_box.html
exec(open('demo_annotation_box.py').read())
plt.savefig('test.png', bbox_inches='tight')

Actual outcome

test

Expected outcome
A crop that respects the bounding boxes of the annotations to the right.

Matplotlib version

  • Operating system: CentOS Linux release 7.5.1804 (Core)
  • Matplotlib version: 3.0.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.6
  • Jupyter version (if applicable): NA - but the same issue also appears in notebooks on jupyter 4.4.0 with the inline backend
  • Other libraries: conda 4.5.11 with the following environment spec:
conda list
# packages in environment at /home/jc01/anaconda3/envs/mpltest:
#
# Name                    Version                   Build  Channel
backcall                  0.1.0                      py_0    conda-forge
blas                      1.0                         mkl  
ca-certificates           2018.10.15           ha4d7672_0    conda-forge
certifi                   2018.10.15            py36_1000    conda-forge
cycler                    0.10.0                     py_1    conda-forge
dbus                      1.13.0               h3a4f0e9_0    conda-forge
decorator                 4.3.0                      py_0    conda-forge
expat                     2.2.5                hfc679d8_2    conda-forge
fontconfig                2.13.1               h65d0f4c_0    conda-forge
freetype                  2.9.1                h6debe1e_4    conda-forge
gettext                   0.19.8.1             h5e8e0c9_1    conda-forge
glib                      2.56.2               h464dc38_0    conda-forge
gst-plugins-base          1.12.5               hde13a9d_0    conda-forge
gstreamer                 1.12.5               h5856ed1_0    conda-forge
icu                       58.2                 hfc679d8_0    conda-forge
intel-openmp              2019.0                      118  
ipython                   7.1.1           py36h24bf2e0_1000    conda-forge
ipython_genutil
5EED
s          0.2.0                      py_1    conda-forge
jedi                      0.13.1                py36_1000    conda-forge
jpeg                      9c                   h470a237_1    conda-forge
kiwisolver                1.0.1            py36h2d50403_2    conda-forge
libffi                    3.2.1                hfc679d8_5    conda-forge
libgcc-ng                 8.2.0                hdf63c60_1  
libgfortran-ng            7.2.0                hdf63c60_3    conda-forge
libiconv                  1.15                 h470a237_3    conda-forge
libpng                    1.6.35               ha92aebf_2    conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3    conda-forge
libuuid                   2.32.1               h470a237_2    conda-forge
libxcb                    1.13                 h470a237_2    conda-forge
libxml2                   2.9.8                h422b904_5    conda-forge
matplotlib                3.0.1                h8a2030e_1    conda-forge
matplotlib-base           3.0.1            py36hc039c98_1    conda-forge
mkl                       2019.0                      118  
mkl_fft                   1.0.6                    py36_0    conda-forge
mkl_random                1.0.1                    py36_0    conda-forge
ncurses                   6.1                  hfc679d8_1    conda-forge
numpy                     1.15.3           py36h1d66e8a_0  
numpy-base                1.15.3           py36h81de0dd_0  
openssl                   1.0.2p               h470a237_1    conda-forge
parso                     0.3.1                      py_0    conda-forge
pcre                      8.41                 hfc679d8_3    conda-forge
pexpect                   4.6.0                 py36_1000    conda-forge
pickleshare               0.7.5                 py36_1000    conda-forge
pip                       18.1                  py36_1000    conda-forge
prompt_toolkit            2.0.7                      py_0    conda-forge
pthread-stubs             0.4                  h470a237_1    conda-forge
ptyprocess                0.6.0                 py36_1000    conda-forge
pygments                  2.2.0                      py_1    conda-forge
pyparsing                 2.3.0                      py_0    conda-forge
pyqt                      5.6.0            py36h8210e8a_7    conda-forge
python                    3.6.6                h5001a0f_3    conda-forge
python-dateutil           2.7.5                      py_0    conda-forge
qt                        5.6.2                hf70d934_9    conda-forge
readline                  7.0                  haf1bffa_1    conda-forge
setuptools                40.5.0                   py36_0    conda-forge
sip                       4.18.1           py36hfc679d8_0    conda-forge
six                       1.11.0                py36_1001    conda-forge
sqlite                    3.25.2               hb1c47c0_0    conda-forge
tk                        8.6.8                ha92aebf_0    conda-forge
tornado                   5.1.1            py36h470a237_0    conda-forge
traitlets                 4.3.2                 py36_1000    conda-forge
wcwidth                   0.1.7                      py_1    conda-forge
wheel                     0.32.2                   py36_0    conda-forge
xorg-libxau               1.0.8                h470a237_6    conda-forge
xorg-libxdmcp             1.1.2                h470a237_7    conda-forge
xz                        5.2.4                h470a237_1    conda-forge
zlib                      1.2.11               h470a237_3    conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0