Current location - Plastic Surgery and Aesthetics Network - Wedding planning company - How does matplotlib generate a pure black curtain?
How does matplotlib generate a pure black curtain?
Matplotlib can generate pure black curtains by doing the following:

1, open any editor first.

2. After opening the editor, import the matplotlib package to be used.

3. Enter the code img = np.zeros ((512,512,3), np. Uint8) creates a picture, where NP. The matrix represented by Zeros () function is filled with the number 0, which is black in rgb color representation. The picture size is determined by the parameter (5 12).

4. Enter the code for displaying the picture, as follows: plt.imshow (img [:,:-1]) plt.show ().

5. Click the triangle button in the upper right corner of vscode to run the code.

6. After running the code, a black picture with the size of 5 12*5 12 appears. Click the Save button to save the picture. These are the steps for matplotlib to generate a pure black curtain.