8000 ylabel clipped with Qt5Agg backend when saving figure to png with both bbox_inches='tight' and pad_inches=0 · Issue #8473 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
ylabel clipped with Qt5Agg backend when saving figure to png with both bbox_inches='tight' and pad_inches=0  #8473
Open
@x49

Description

@x49

Bug report

Using the Qt5Agg backend, applying both bbox_inches='tight' and pad_inches=0 together clips ylabel texts when saving to png format. The same text is not clipped when saving as pdf or with the GTK3Cairo backend.

Code for reproduction

import matplotlib

matplotlib.use('Qt5Agg')    ## Causes clipping
#matplotlib.use('GTK3Cairo') ## No clipping

import matplotlib.pyplot as plt

plt.ioff()
plt.plot([1,2,3],[3,1,2])

plt.xlabel('This text is ok. yyggjjpp [] () {}')
plt.ylabel('Top is cut off, for example the fs and brackets. [] () {}')

### Neither PNG nor PDF is clipped with either backend
plt.savefig('test-tight.png',bbox_inches='tight')
plt.savefig('test-tight.pdf',bbox_inches='tight')

### PNG is clipped with Qt5Agg, not GTK3Cairo, pdf is never clipped
plt.savefig('test-tight-nopad.png',bbox_inches='tight',pad_inches=0)
plt.savefig('test-tight-nopad.pdf',bbox_inches='tight',pad_inches=0)

Actual outcome
When using backend 'Qt5Agg' in the png output, tall characters in the ylabel are clipped.
test-tight-nopad

Expected outcome
I expect to produce comparable output to the 'GTK3Cairo' backend, which does not clip the labels.
test-tight-nopad

Matplotlib version
All installed from Arch Linux x64 repositories.

  • Python 3.6.0
  • Matplotlib 2.0.0
  • python-pyqt5 5.8
  • python-cairocffi 0.8.0
  • python-gobject 3.22.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0