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

  • 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
  • 3
    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. – jub0bs 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).

\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}$};

enter image description here

| 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 '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
  • 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 '14 at 11:48
  • Or \draw[densely dashed] (-1,0).. controls (-0.7,0) and (0,0.7) .. (0,1) .. controls (0,0.7) and (0.7,0) .. (1,0) .. controls (0.7,0) and (0,-0.7) .. (0,-1) .. controls (0,-0.7) and (-0.7,0) .. (-1,0); – JPi Jul 16 '14 at 1:17

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



enter image description here

| improve this answer | |

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.