enter image description here

Is there anyone who would like to help me draw this diagram in LaTeX? :-) I got help yesterday to draw the diagram, point and so on but I can't figure out how to draw the little boxes and the lines between points.

The code I got yesterday, and tried to edit...


 % draw axis


 % draw ticks 

 \foreach \i in {1,2,3}
 {\draw (\i,0.1)--(\i,-0.1)node[below]{$\frac{\i}{4}$};
 \draw (0.1,\i)--(-0.1,\i)node[left]{$\frac{\i}{4}$};

 % draw bullets 

 \foreach \i in {0,...,3}
 {\foreach \j in {0,...,3}
 \node[fill=black,circle,inner sep=1pt] (\i-\j) at (\i,\j) {};

 % label for bullets x and y

 \node[below right] at (2-1){$y_{j}$};
 \node[below] at (1-2){$x_{j}$}; 
 %\draw[decorate,decoration={brace,raise=3pt}](1-2)--(3-2)node[midway,above=4pt] {$|x-y|_\infty$};

 % dashed arrows


  • 2
    Do this for me question are really poor. Have you tried anything yet? Mar 16 '16 at 8:40
  • 4
    Most of that diagram was drawn for you in a different question, you could at the very least refer to that and specify what the trouble is here. Saying "I have this code which does the following, how can I extend it to do this other thing" is much better than just posting an image of what you need done. Mar 16 '16 at 8:56
  • 1
    Sorry, i'm new to this. I understand i should refer, i will do that next time.
    – Jeanett
    Mar 16 '16 at 8:57
  • 1
    You should add the code as a MWE of what you got already and revise your description and question...
    – Eric
    Mar 16 '16 at 9:23
  • 1
    I tried do add the code but i don't think i did it right because it doesn't show :/
    – Jeanett
    Mar 16 '16 at 9:53

To draw cross hatch box you can use \clip or \path[clip] inside a scope environment to limit showing diagonal lines inside a path which follows the edge of the two boxes.




 % draw axis


 % draw ticks 

 \draw (5,2pt)--(5,-2pt)node[below]{$1$};
 \draw (2pt,5)--(-2pt,5)node[left]{$1$};

 % draw bullets 

 \foreach \i in {0,...,4}
 {\foreach \j in {0,...,4}
 \node[fill=black,circle,inner sep=1pt]  at (\i,\j) {};

 % label for bullets x and y

 \node[below] at (2,1){$y_{j}$};
 \node[below] at (1,2){$x_{j}$}; 

 % cross hatch boxes

 \foreach \sh in {-4,-3.9,...,4}
 {\draw[help lines] (1,1+\sh)--(3,3+\sh);}

 \node [fill=black,circle,inner sep=1pt,label=below:$x$ ]at(1.8,2.3){};
 \node [fill=black,circle,inner sep=1pt,label=below:$y$ ]at(2.2,1.8){};

 % dashed arrows




enter image description here


A PSTricks solution:




\begin{pspicture}(-0.335,-0.415)(5.5,5.5) % frame parameters found manually
  \multido{\iA = 0+1}{5}{\multido{\iB = 0+1}{5}{\psdot(\iA,\iB)}}
 {\psset{linestyle = none, fillstyle = hlines}
 {\psset{linestyle = dashed}
  \uput[295](1.5,2){$x_{j + 1}$}
  \uput[295](2.5,1){$y_{j + 1}$}}



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.