unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70687: python-matplotlib not respecting env var MPLBACKEND=TkAgg
@ 2024-05-01  1:23 Jake
  0 siblings, 0 replies; only message in thread
From: Jake @ 2024-05-01  1:23 UTC (permalink / raw)
  To: 70687

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

Hello

We are supposed to be able to control the backend used by Python's
Matplotlib via the MPLBACKEND environment variable [1]. This doesn't appear
to work for the TkAgg backend:

#+begin_src sh

  guix shell python python-matplotlib -- bash -c 'MPLBACKEND=TkAgg python3
-c "import matplotlib; print(matplotlib.get_backend()); import
matplotlib.pyplot as plt; plt.plot([1],[2]); plt.show()"'

#+end_src

#+RESULTS:
: TkAgg
: <string>:1: UserWarning: FigureCanvasAgg is non-interactive, and thus
cannot be shown

However, the TkAgg backend does work if it is hardcoded in the Python
script using `matplotlib.use()`:

#+begin_src sh

  guix shell python python-matplotlib -- python3 -c "import matplotlib;
matplotlib.use('TkAgg'); print(matplotlib.get_backend()); import
matplotlib.pyplot as plt; plt.plot([1],[2]); plt.show()"

#+end_src

#+RESULTS:
: TkAgg

Thanks
Jake

[1]: https://matplotlib.org/stable/users/explain/figure/backends.html

[-- Attachment #2: Type: text/html, Size: 1243 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-01  1:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01  1:23 bug#70687: python-matplotlib not respecting env var MPLBACKEND=TkAgg Jake

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).