# Beginner: Drawing using Tikz

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?

-
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 '14 at 9:26
Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – Jubobs Aug 14 '14 at 12:08

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}


-
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 '14 at 7:34
@Sooraj Try something like \draw[dashed] (-1,0) to[bend right] (0,1); – Torbjørn T. Jul 15 '14 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 '14 at 7:46
@Jesse: Or, equivalently, \draw[dashed, bend right] (-1,0) to (0,1) to (1,0) to (0,-1) to (-1,0); – Jake Jul 15 '14 at 11:48
@Jake -- Wow, thanks. – Jesse Jul 15 '14 at 15:25

A direct translation from TikZ (with 374 characters) to PSTricks (with 362 characters).

\documentclass[pstricks,border=3mm]{standalone}
\usepackage{pst-node}

\begin{document}
\begin{pspicture}(-1.5,-1.5)(3,3)
\psline{->}(-1.5,0)(3,0)
\psline{->}(0,-1.5)(0,3)
\pspolygon[linestyle=dashed](-1,0)(0,1)(1,0)(0,-1)
\uput[-135](0,0){$x$}
\pcline[nodesepA=-1,nodesepB=-3mm](0,1)(2,0)\naput{$A$}
\uput[45](0,1){$\hat{x}$}
\end{pspicture}
\end{document}


-