3

I have this fragment of matapost code which draw a smooth curve through points using .. operation

\documentclass{article}
\usepackage{mpgraphics} 
\begin{document} 

\begin{mpdisplay}
z0 = (0,0);
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);
z4 = (30,50);
path p;
p = z0..z1..z2..z3..z4..cycle;
draw p; 
\end{mpdisplay}

\end{document}

Which produce a nice closed smooth line ( compiled with pdflatex --shell-escape )

enter image description here

I would like to draw the above picture with tikz, and I do not want to use ..controls operation. I want the simplest way to draw a smooth closed line such as the picture.

4

You can use the hobby package (or TikZ library):

\documentclass[tikz]{standalone}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
  \path
  (0,0) coordinate (z0)
  (60,40) coordinate (z1)
  (40,90) coordinate (z2)
  (10,70) coordinate (z3)
  (30,50) coordinate (z4);
  \draw[closed] (z0) .. (z1) .. (z2) .. (z3) .. (z4);
\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.