ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 02 Dec 2015 03:28:13 +0100Can I scatter plot shaded grids?https://ask.sagemath.org/question/31240/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?Tue, 01 Dec 2015 14:57:45 +0100https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/Answer by kcrisman for <p>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?</p>
https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?answer=31241#post-id-31241You'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! Tue, 01 Dec 2015 16:59:29 +0100https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?answer=31241#post-id-31241Comment by kcrisman for <p>You'll want to use a combination of <code>matrix_plot</code> and <code>scatter_plot</code>/<code>points</code>. <code>matrix_plot</code> 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! </p>
https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?comment=31256#post-id-31256That's awesome!Wed, 02 Dec 2015 03:28:13 +0100https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?comment=31256#post-id-31256Comment by ctennenh for <p>You'll want to use a combination of <code>matrix_plot</code> and <code>scatter_plot</code>/<code>points</code>. <code>matrix_plot</code> 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! </p>
https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?comment=31243#post-id-31243Thanks 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.Tue, 01 Dec 2015 19:17:02 +0100https://ask.sagemath.org/question/31240/can-i-scatter-plot-shaded-grids/?comment=31243#post-id-31243