Jul/12/2022 Updated by
Mar/26/2022 Created by

Quick Learning: Matplotlib Tutorial (compatible with Google Colab / Windows / macOS / Linux) by nitta@tsuda.ac.jp


[Up] Japanese English

Learning Policy

Since matplotlib is a flexible system, it can be written in various ways, which confuses beginners. In this article, we will explain how to write matplotlib programming easily according to the small number of cardinal rules, that is, a method with a wide range of applications but less confusion. Being able to solve various problems with one method is the fastest way to improve your matplotlib programming.


Contents


Compatibility Check

The versions of OS and python packages when checking the compatibilities are as follows.    html    ipynb

Known Issues

  1. On Linux (intel), some errors occur at the OpenAI gym in "matplotlib_tutorial_14{,_en}.ipynb". (Jul/12/2022)
  2. On macOS (arm64), some errors occur at the anim.save('*.mp4') in "matplotlib_tutorial_13{,_en}.ipynb". (Jul/12/2022)

Execution Environment on Google Colabe

The codes below can be executed in the default state.

Execution Environment on Anaconda on Windows / macOS / Linux

  1. Create a Python virtual environment with the packages installed.
  2. "Anaconda Prompt"(on Windows) or "Terminal"(on macOS or Linux)
    (base) nitta$ conda create -n myenv python jupyter  
    (base) nitta$ conda activate myenv  
    (myenv) nitta$ pip install numpy  
    (myenv) nitta$ pip install matplotlib  
    (myenv) nitta$ pip install tensorflow  
    (myenv) nitta$ pip install --user pygame  
    (myenv) nitta$ pip install gym  
    (myenv) nitta$ conda deactivate  
    (base) nitta$ 
    
  3. Execute jupyter notebook.
  4. "Anaconda Prompt"(on Windows) or "Terminal" (on macOS or Linux)
    (base) nitta$ conda activate myenv  
    (myenv) nitta$ jupyter notebook  
    

OS Depencencies

On macOS (intel), ffmpeg needs to be installed to save animations as files. You can install it with the "brew intall ffmpeg" command using homebrew.

On Linux(intel) , ffmpeg needs to be installed to save animations as files. You can install it with the "sudo apt update; sudo apt intall ffmpeg" command on Utuntu Linux.