Package: python3-matplotlib
Version: 3.3.4-1
Severity: normal

Dear Maintainer,


I have experienced intermittent problems with the default TkAgg backend for 
python3-matplotlib since I upgraded from buster to bullseye. The problems 
go away if you start a program with

import matplotlib as mp
mp.use("Qt5Agg")

to switch to a different backend. I include an example below which triggers 
a slew of Tk error messages, although the output seems correct. Sometimes 
there are problems with the output as well; I am still trying to produce an
example that produces wrong graphical output but which is simple enough to 
submit in a bug report. It appears that to trigger the error messages you 
need to 

(*) Use plt.ion() as you would in ipython3 (rather than using plt.show() as
you would from the shell).

(*) Use plt.savefig(bbox_inches="tight")

Best wishes

Hugh Pumphrey



##########Begin######example####################
import matplotlib as mp

## Uncomment next line to switch to working Qt5Agg backend
## Default is the same as mp.use("TkAgg")
##mp.use("Qt5Agg")
##mp.use("TkAgg")

import numpy as np
import matplotlib.pyplot as plt

plt.ion()
## plt.close("all")
fig=plt.figure(figsize=(8,4))
plt.clf()
ax=plt.axes()
x=np.linspace(0,10,11)
ax.plot(x,x*x,"ro")
ax.text(5,30,"Test text",fontsize=18)
## plt.show()

## Tk errors get emitted only when you do a plt.savefig()
## with the bbox_inches="tight" option. It is a bit mysterious exactly
## how it is triggered. Use of plt.ion() seems needed.

plt.savefig("test.png",bbox_inches="tight")
#####end######example#########################

-- System Information:
Debian Release: 11.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-matplotlib depends on:
ii  libc6                               2.31-13
ii  libfreetype6                        2.10.4+dfsg-1
ii  libgcc-s1                           10.2.1-6
ii  libjs-jquery                        3.5.1+dfsg+~3.5.5-7
ii  libjs-jquery-ui                     1.12.1+dfsg-8
ii  libstdc++6                          10.2.1-6
ii  python-matplotlib-data              3.3.4-1
ii  python3                             3.9.2-3
ii  python3-cycler                      0.10.0-3
ii  python3-dateutil                    2.8.1-6
ii  python3-kiwisolver                  1.3.1-1+b1
ii  python3-numpy [python3-numpy-abi9]  1:1.19.5-1
ii  python3-pil                         8.1.2+dfsg-0.3
ii  python3-pyparsing                   2.4.7-1
ii  python3-six                         1.16.0-2

Versions of packages python3-matplotlib recommends:
ii  python3-tk  3.9.2-1

Versions of packages python3-matplotlib suggests:
ii  dvipng                 1.15-1.1+b1
ii  ffmpeg                 7:4.3.2-0+deb11u2
ii  ghostscript            9.53.3~dfsg-7
ii  gir1.2-gtk-3.0         3.24.24-4
pn  inkscape               <none>
ii  ipython3               7.20.0-1
ii  librsvg2-common        2.50.3+dfsg-1
pn  python-matplotlib-doc  <none>
pn  python3-cairocffi      <none>
ii  python3-gi             3.38.0-2
pn  python3-gi-cairo       <none>
pn  python3-gobject        <none>
ii  python3-nose           1.3.7-7
ii  python3-pyqt5          5.15.2+dfsg-3
ii  python3-scipy          1.6.0-2
ii  python3-sip            4.19.25+dfsg-1
ii  python3-tornado        6.1.0-1+b1
ii  texlive-extra-utils    2020.20210202-3
ii  texlive-latex-extra    2020.20210202-3
pn  ttf-staypuft           <none>

-- no debconf information

Reply via email to