Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was quite impressed by the figures generated by TikZ and wanted to try TikZ to generate a few figures (please see the attached image drawn using an external WYSWYG program). When I tried to reproduce the figures myself using TikZ I found it very difficult to control the shapes in required positions. What is the simplest method to draw!these figures using TikZ?

enter image description here

share|improve this question
    
Apart from the pgfmanual, I would recommend to look at http://texample.net/ or at the Graphics with TikZ article to begin coding with TikZ. –  Clément Jul 15 at 9:26

1 Answer 1

With next code you can obtain first example. All others can be easily done after reading first tutorial in TiKZ documentation (pgfmanual).

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw [->] (-1.5,0)--(3,0);
\draw [->] (0,-1.5)--(0,3);
\draw[dashed] (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
\node[below left] at (0,0) {$x$};
\draw[shorten <=-1cm, shorten >=-3mm] (0,1)--(2,0) node [midway, above] {$A$};
\node[above right] at (0,1) {$\hat{x}$};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Thanks for the code. I could modify your code to get second and third figures. But still facing problems with the last figure! –  Sooraj Jul 15 at 7:34
    
@Sooraj Try something like \draw[dashed] (-1,0) to[bend right] (0,1); –  Torbjørn T. Jul 15 at 7:45
    
Use this. \draw[dashed] (-1,0) to [bend right] (0,1) to [bend right] (1,0) to [bend right] (0,-1) to [bend right] (-1,0); –  Jesse Jul 15 at 7:46
1  
@Jesse: Or, equivalently, \draw[dashed, bend right] (-1,0) to (0,1) to (1,0) to (0,-1) to (-1,0); –  Jake Jul 15 at 11:48
    
@Jake -- Wow, thanks. –  Jesse Jul 15 at 15:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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