Ask Your Question
1

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

asked 2020-12-05 05:43:20 +0200

PatB gravatar image

updated 2020-12-05 08:53:51 +0200

FrédéricC gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-12-05 12:08:08 +0200

slelievre gravatar image

This seems to work fine in recent Sage.

  • with Jupyter on my local installation (Sage 9.3.beta2)
  • on SageCell (main server currently at Sage 9.1; test server currently at Sage 9.2)

Illustration:

In your Jupyter, try clicking in the "left margin" of the output, this might toggle between truncated view and full view.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-12-05 05:43:20 +0200

Seen: 175 times

Last updated: Dec 05 '20