Home  >  Article  >  Backend Development  >  Python implements two-dimensional array output as picture_python

Python implements two-dimensional array output as picture_python

不言
不言Original
2018-04-04 16:09:063329browse

The editor below will share with you an article about how to output a two-dimensional array as a picture in Python. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor and take a look

For two-dimensional arrays, 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)

Related recommendations:


Python implements the method of using a generator to implement iterable objects

Python implements type checking of instance attributes

Python implements tree printing directory structure_python

The above is the detailed content of Python implements two-dimensional array output as picture_python. 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