5

Could you help to draw a curved path joining the (0,3) and (0,4)? I find the draw command with in and out options hard even after reading about it.

enter image description here

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\begin{document}
\begin{tikzpicture}

  \draw[decoration={aspect=.23, segment length=2.0285mm, amplitude=4.16mm,coil},decorate] (0,5.2) -- (0,4); 

  \draw(0,5.2)--(0,6)--(-1.4,6);
  \draw(-1.5,6.5)--(-2,6)--(-3,6)--(-3,5);
  \draw[fill=black](-3,5) circle(3pt);
  \draw[fill=black](-3,4) circle(3pt);

  \draw(-3,4)--(-3,3)--(0,3);

  \draw  (0,3) % Draws a line
  to [out=-10,in=-40] (.24,3.1125)
  to [out=10,in=70] (.641,3.6) 
  to [out=-90,in=30] (0,4); 
\end{tikzpicture}
\end{document}
7

You can try something like this to draw curve between (0,3) and (0,4).

  \draw (0,3) to[out=30,in=210,looseness=2] (0,4);

Alternate way is to use controls

  \draw (0,3) ..controls (1,3.25) and (-1,3.75).. (0,4);

Result:

enter image description here

The complete code:

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\begin{document}
\begin{tikzpicture}
\begin{scope}
  \draw[decoration={aspect=.23, segment length=2.0285mm, amplitude=4.16mm,coil},decorate] (0,5.2) -- (0,4); 
  \draw(0,5.2)--(0,6)--(-1.4,6);
  \draw(-1.5,6.5)--(-2,6)--(-3,6)--(-3,5);
  \draw[fill=black](-3,5) circle(3pt);
  \draw[fill=black](-3,4) circle(3pt);

  \draw(-3,4)--(-3,3)--(0,3);
   \draw (0,3) ..controls (1,3.25) and (-1,3.75).. (0,4);
\node[below] at (0,3) {With \texttt{controls}};
\end{scope}
\begin{scope}[xshift=5cm]
  \draw[decoration={aspect=.23, segment length=2.0285mm, amplitude=4.16mm,coil},decorate] (0,5.2) -- (0,4); 
  \draw(0,5.2)--(0,6)--(-1.4,6);
  \draw(-1.5,6.5)--(-2,6)--(-3,6)--(-3,5);
  \draw[fill=black](-3,5) circle(3pt);
  \draw[fill=black](-3,4) circle(3pt);

  \draw(-3,4)--(-3,3)--(0,3);

  \draw (0,3) to[out=30,in=210,looseness=2] (0,4);
\node[below] at (0,3) {With \texttt{to}};
\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.