Ask Your Question
1

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

asked 4 years ago

PatB gravatar image

updated 4 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

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.

Preview: (hide)
link

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: 4 years ago

Seen: 243 times

Last updated: Dec 05 '20