2

I can't draw planes simple curves (other than circles or ellipses), closed as these enter image description here

  • Possible duplicate: tex.stackexchange.com/questions/17181/… – Andrew Jun 18 '15 at 10:13
  • Excuse me, I think the curves drawn there are curves in spaces – benedito Jun 18 '15 at 10:28
  • @Andrew I'd say no: knots and curves are not the same thing. – egreg Jun 18 '15 at 10:29
  • In Metapost the first one is as simple as drawarrow origin {left} .. 34 down {right} .. 10 up .. 21 down .. cycle; Can you do something like that in TikZ with the hobby package? – Thruston Jun 18 '15 at 11:42
  • 1
    @Thruston Yes. Posted an answer with that. – Alenanno Jun 18 '15 at 13:52
4

As it was suggested to you in the comments, you can use the hobby Tikz library and use the option [closed hobby] in the draw options. Notice that it follows the same syntax of a plot by using coordinates (it is a plot, after all).

Output

figure 1

Code

\documentclass[tikz,margin=10pt]{standalone}
\usetikzlibrary{hobby}

\begin{document}
\begin{tikzpicture}
\draw[closed hobby] plot coordinates {(0,0) (1,1) (0,1) (.5,.3) (.5,.7) (0,0)};

\begin{scope}[xshift=3cm]
\draw[closed hobby] plot coordinates {(0,0) (1,1) (2,0) (2,1)};
\end{scope}
\end{tikzpicture}
\end{document}

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.