In which environment can I draw a 2d lattice (say over Z) and maybe colour various parts (e.g. excluding all points for which (x,y) > (2,2)?

Maybe tikz is a solution but I am not sure where to start from (e.g. how to define a lattice with an origin etc). There is a similar question but does not help a lot.

I upload a picture so that I make clearer what I want to do. The blue axes are the usual (x,y) axes but I also want to draw lines or exes beginning at other points and I want to exclude regions by coloring them. The arrows are not important. Also I do not mind if the lattice points appear too, actually that would be useful.

enter image description here

  • This is a very vague question. Nevertheless you can probably do this with tikz. Just scroll through the TikZ & PGF manual or the pgfplots manual. Find something which looks like what you envision than edit it. – Roald Sep 27 '16 at 17:12
  • I know I can use tikz, I just have no time for this and thus I asked the help of the community. – Marion Sep 27 '16 at 23:10
  • @Roald I have expanded the question and included a picture for better understanding. – Marion Sep 28 '16 at 11:37

Here is a starting point using \foreach loops to iterate over all lattice points. I added also an example condition (i,j) > (2,2):

    % labels
    \foreach \i in {0,...,5}
      \path[blue] (\i,-1) node{\i} (-1,\i) node{\i};
    % loop over the lattice points
    \foreach \i in {0,...,5}
      \foreach \j in {0,...,5}{
        \draw (\i,\j) circle(3pt);
        % check if (\i,\j) > (2,2)
        \ifnum \i > 2
          \ifnum \j > 2
            \fill[red] (\i,\j) circle(2pt);

enter image description here

| improve this answer | |
  • thanks a lot, I am interested in having both negative and positive axes and coloring out regions (rather than dots). But thanks for your help! – Marion Sep 27 '16 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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