The commands on the following page has been performed and tested with the following versions:
Installation and configuration of Python and Visual Studio Code has been perfomed by following this step by step guide.
Start by updating your system:
sudo apt update sudo apt upgrade
If you work with virtual environments, do not forget to activate your environment before installing matplotlib, otherwise it will be installed system wide. The following command installs matplotlib:
sudo apt install python3-matplotlib
python -m pip install -U matplotlib
Create and run the following Python script:
import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4]) plt.ylabel('some numbers') plt.show()
If the chart is not displayed or if you get the following error
UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
sudo apt-get install python3-tk
The script should now display the following figure: