I have a pretty big binary matrix of maybe 70 rows and 64 columns. For ease of viewing, I would like to draw this matrix in TikZ where e.g. a 1 is represtented by a red square and a 0 is a white square.
Does anyone have any idea how I could obtain this?
Ideally, I would have something where I can just load the matrix from a file and TikZ would handle everything else. Otherwise, I am also happy with a solution having to do find/replace every 0 by some string, and replace every 1 by another string.
Thank you in advance!
Example matrix:
10110101010
10010101010
01010111010
11110010100
01100011001
11101010111
10101010111
Best Answer
The answer provides two solutions: by means of the first one it is possible to customize the dimension of the squares and perhaps suits better your needs. Both are based on answers given here.
Solution n.1 is based on Create square and custom size cells in a table using pgfplotstable:
The result:
Solution n.2 is based on Parametrize shading in table through TikZ:
The result: