I'm trying to figure out how to plot a region that looks like this:

enter image description here

The squares don't have to be painted like that, if I could have just light green, gray, light blue and light red it would be great. I've tried a few things with RegionPlot and some overlaying, but the codes either don't run or don't give me what I need. Also, I'd like to plot some random black points like these ones in the picture, with these controlled distances in the coordinates. The two main black likes are the $x$ and $y$ axes and the other dotted lines are just connecting the points in $\mathbb{Z}^{2}$ that have a fixed coordinate. Is there a straightforward way to do that? Is RegionPlot\overlaying even the best option? Any help would be greatly appreciated!

  • $\begingroup$ If you just want the picture, use a vector graphics program (or PowerPoint or similar): you will have more control over all features, and it will take you only a few minutes. MMA is not the right tool here. If, on the other hand, you need to run computations on this, then you should explain in more detail what your final goal is. $\endgroup$ – MarcoB Mar 31 at 21:08

Here's something that you could overlay things on with Show (and you could include Axes -> True to show the axes—plus you could style them appropriately)! xmin, xmax, ymin, and ymax are of course adjustable.

{xmin, xmax} = {0, 5}; {ymin, ymax} = {-2, 3};
 Table[Mod[i, 2] + 2 Mod[j, 2], {i, xmin, xmax}, {j, ymin, ymax}], 
 ColorRules -> {0 -> LightGray, 1 -> LightRed, 2 -> LightGreen, 
   3 -> LightBlue}, Mesh -> True, DataReversed -> {True, False}, 
 DataRange -> {{xmin + 1/2, xmax + 1/2}, {ymin + 1/2, ymax + 1/2}},
 AspectRatio -> 1]
  • $\begingroup$ Thanks, this works perfectly! :) $\endgroup$ – ioliveira Apr 1 at 0:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.