Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphically represent lists

Tags:

python

Is there a quick way (without the overhead of using a GUI or graphics module) to visually render 2d and 3d lists.

For example if I have a 2d array of zeros and ones, I would like to draw a black and white grid according to this array.

I am looking for a module that allows me to do these thing in simple ways. Similar to the easiness of that matplotlib allows drawing graphs.

like image 754
Artium Avatar asked Jul 21 '11 10:07

Artium


Video Answer


1 Answers

The command matshow in matplotlib displays a matrix:

import pylab as p
p.matshow(p.array([[0,1],[1,1]]),cmap="Greys") ; p.show()

This would work for 2d lists. As for 3d lists, I'm not sure I fully understand how you're planning on visualising them.

like image 64
Pascal Bugnion Avatar answered Sep 30 '22 19:09

Pascal Bugnion