I would like to write in TikZ something similar to this one

enter image description here

In particular I would be able to draw the line that looks like this "- - - - - ". And also be glad to fill the figure such that it is clear that it continues to infinity and so it is not a bounded set (like the one you can see in the top of the image).

  • 3
    The answer to the question in the title is 'yes'. However, are you able to parts of it yourself? If so, it's always nice if you show us what you have so far. – Torbjørn T. Oct 28 '15 at 21:37

Most of what you need to draw that you can learn from going through the first one or two tutorials in the TikZ manual. Mostly you just need \draw (x1,y1) -- (x2,y2); to draw lines and \node at (x,y) {text}; to place text. To draw a dashed line, do \draw [dashed] (x1,y1) -- (x2,y2); (some other options are dotted, densely dotted and densely dashed).

The most advanced thing in the code below is the part that draws the cross hatching. I think they must be drawn manually, so I use two \foreach loops to draw them. They're drawn in two rounds to get the top part dashed. \clip will remove everything outside the polygon defined by the coordinates, but only for the commands that are inside the scope environment.

enter image description here

\draw [-latex] (0,-0.05) -- (0,6);
\draw [-latex] (-0.5,0) -- (6,0);
\foreach \x in {0,1,2}
  \node [below] at (\x,0) {\x};

\node [left] at (0,1) {$\psi(a)$};
\node [left] at (0,3) {$\psi(b)$};

\draw (0,3) -- (1,1) -- (2,0);
\draw [dashed] (0,1) -| (1,0);

\draw (2,0) -- (2,4);
\draw [dashed] (2,4) -- (2,5.7);

\clip (2,0) -- (1,1) -- (0,3) -- (0,4) -- (2,4) -- (2,0);
\foreach \x in {-4,-3.5,...,1.5}
  \draw (\x,0) -- ++(45:6);
\clip (0,4) rectangle (2,5.7);
\foreach \x in {-1.5,-1,...,1.5}
  \draw [dashed] (\x,4) -- ++(45:4);

\draw (1.5,2.7) -- ++(2,1) node[right,font=\Large] {$\Pi$};
  • WOW! TikZ is really POWERFUL! I will read the tutorials the sooner. Thanks a lot. – Nisba Oct 29 '15 at 0:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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