Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to show lines and images on a chess board (matrix_plot)

Hi, I naively created a chess board with a matrix_plot.

m = matrix_plot([[1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1], [1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1], [1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1], [1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1], [1,0,1,0,1,0,1,0]] ) Shown alone, it looks almost like a chess board, but it has axes and white padding on the periphery

(m).show(aspect_ratio=1)

I then naively tried to add a line to that plot - Q = line([(-0.5,0),(1,1)]) (m+Q).show()

Somehow I have lost the whole matrix plot . This is version 8.7 in a jupyter notebook Q = line([(-0.5,0),(1,1)]) (m+Q).show() i only get 2 rows - the rest is truncated.

Question - how to graph lines on top of this matrix plot without truncating the apprearance?

Merci! Pat

click to hide/show revision 2
None

How to show lines and images on a chess board (matrix_plot)

Hi, I naively created a chess board with a matrix_plot.

m = matrix_plot([[1,0,1,0,1,0,1,0],
                 [0,1,0,1,0,1,0,1],
                 [1,0,1,0,1,0,1,0],
                 [0,1,0,1,0,1,0,1],
                 [1,0,1,0,1,0,1,0],
                 [0,1,0,1,0,1,0,1],
                 [1,0,1,0,1,0,1,0],
                 [0,1,0,1,0,1,0,1],
                 [1,0,1,0,1,0,1,0]]
                  )

Shown alone, it looks almost like a chess board, but it has axes and white padding on the periphery

(m).show(aspect_ratio=1)

 (m).show(aspect_ratio=1)

I then naively tried to add a line to that plot -

Q = line([(-0.5,0),(1,1)])
(m+Q).show()

(m+Q).show()

Somehow I have lost the whole matrix plot . This is version 8.7 in a jupyter notebook notebook

Q = line([(-0.5,0),(1,1)])
(m+Q).show()

i only get 2 rows - the rest is truncated.

Question - how to graph lines on top of this matrix plot without truncating the apprearance?

Merci! Pat