• Python: 3.8.11
  • Matplotlib: 3.3.4
  • OS: Ubuntu Kylin 20.04
  • Conda: 4.10.1
  • Jupyter lab: 3.1.4

Code sample

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
Copy the code
  • Color according to the values of the elements in the array. Same value, same color; Different values, different colors.
  • The function also has a number of optional parameters that can be configured for the generated image.
plt.imshow(np.zeros([2.2]))
Copy the code

plt.imshow(np.array([[0.1], [2.3]]))
Copy the code

The source code to learn

help(matplotlib.pyplot)

Help on module matplotlib.pyplot in matplotlib:

NAME
    matplotlib.pyplot

DESCRIPTION
    `matplotlib.pyplot` is a state-based interface to matplotlib. It provides
    a MATLAB-like way of plotting.

......    
Copy the code

Learning to recommend

  • Python documentation – English
  • Python documentation – Chinese
  • Python code PEP
  • Google version of the Python specification
  • Python source code
  • Python PEP
  • Optimal kirin
  • The nuggets platform
  • Gitee platform


Python is open source, cross-platform, interpretive, interactive, and worth learning. Python’s design philosophy: elegant, unambiguous, simple. Advocate one way, preferably only one way to do one thing. Code should be written in accordance with specifications to facilitate communication and understanding. Every language has its own unique ideas. Beginners need to change their thinking, practice and accumulate.