Home  >  Article  >  Backend Development  >  Python method to output two-dimensional array as picture

Python method to output two-dimensional array as picture

php中世界最好的语言
php中世界最好的语言Original
2018-04-09 15:27:347994browse

This time I will bring you Python method to output two-dimensional array to picture, Python outputs two-dimensional array to of the picture What are the precautions? The following is a practical case, let’s take a look.

For a two-dimensional array, img_mask

[[ 0 0 0 ..., 7 7 7]
 [ 0 0 0 ..., 7 7 7]
 [ 0 0 0 ..., 7 7 7]
 ..., 
 [266 266 266 ..., 253 253 253]
 [266 266 266 ..., 253 253 253]
 [266 266 266 ..., 253 253 253]]

The code displayed as a picture is:

import matplotlib.pyplot as pyplot 
pyplot.imshow(im_mask)

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Summary of Pycharm usage skills

How to use the max function in a two-dimensional list

The above is the detailed content of Python method to output two-dimensional array as picture. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn