Matplotlib-Installation#

Mit Spack könnt ihr Matplotlib in eurem Kernel bereitstellen, z.B. mit:

$ spack env activate python-311
$ spack install py-matplotlib

Alternativ könnt ihr Matplotlib auch mit anderen Paketmanagern installieren, z.B. mit Pipenv:

$ pipenv install matplotlib

Die Installation könnt ihr dann überprüfen mit:

>>> import matplotlib.pyplot as plt

Bemerkung

Wenn ihr den Fehler TclError: no display name and no $DISPLAY environment variable erhaltet, müsst ihr vermutlich das iPython-Backend für Matplotlib verwenden mit

import matplotlib.pyplot as plt

# iPython backend for matplotlib
%matplotlib inline

Sofern Ihr Matplotlib in einer Python-Datei importiert, müsst ihr stattdessen folgendes einfügen:

import matplotlib.pyplot as plt


# iPython backend for matplotlib
get_ipython().run_line_magic("matplotlib", "inline")