Ask Your Question

# Can I scatter plot shaded grids?

I would like to make a scatter plot, much like those in blog.zacharyabel.com/2012/06/putting-the-why-in-wythoff/ and blog.zacharyabel.com/2012/04/wythoffs-game-red-or-blue/ regarding Wythoff's Game. Right now my best approximation is using scatter_plot and gridlines='minor', but it's not quite what I'm looking for. Does anyone know if it's possible in Sage?

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

You'll want to use a combination of matrix_plot and scatter_plot/points. matrix_plot should accept a number of different colormaps, you'll want to just enter two values in your matrix to get just two colors (default is greyscale, I believe, so white and black). Good luck!

more

## Comments

Thanks Karl-Dieter! I have the following spitting out black and white spaces. I've been trying to figure out how to use subdivisions to get horizontal and vertical lines to differentiate neighboring squares of the same color, but am coming up blank.

T=[[2,3],[1,5],[5,1]]
M=[[1 for x in range(6)] for x in range(6)]
for L in T:
M[L[0]][L[1]]=0
m=matrix(M)
matrix_plot(m)


Is there a way to get lines? Gridlines only puts the lines through the centers of each square.

Edit: I think I have it. I added the following line:

m.subdivide(range(n),range(n))


and included subdivisions=True in matrix_plot.

( 2015-12-01 19:17:02 +0200 )edit

That's awesome!

( 2015-12-02 03:28:13 +0200 )edit

## Your Answer

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

Add Answer

## Stats

Asked: 2015-12-01 14:57:45 +0200

Seen: 176 times

Last updated: Dec 01 '15