Ask Your Question
1

Can I scatter plot shaded grids?

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

ctennenh gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-12-01 16:59:29 +0200

kcrisman gravatar image

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!

edit flag offensive delete link 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.

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

That's awesome!

kcrisman gravatar imagekcrisman ( 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

Question Tools

1 follower

Stats

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

Seen: 295 times

Last updated: Dec 01 '15