2

Consider following MWE:

\begin{tikzpicture}
\draw (0,0) -- (1,1) -- (2,0);
\draw plot [smooth, tension=1.5] coordinates{(0,0) (1,-1) (2,0)};
\begin{scope}[xshift=3cm]
    \draw[line width=1.5] (0,0) -- (1,1) -- (2,0);
    \draw[line width=1.5] plot [smooth, tension=1.5] coordinates{(0,0) (1,-1) (2,0)};
\end{scope}
\end{tikzpicture}

that produces following picture:

enter image description here

In the right-hand part, because of the line width, there are 2 small "gaps" where the lines and the smooth curve join.

In some cases, it might be barely noticeable in print. But if it is the case, is there something you can do in Tikz that is smarter than vertically shifting the begin and end points of the curve, on order to obtain more overlap?

2
  • 2
    you usually want to draw a single path then the corners are automatically taken care of. Dec 20, 2020 at 22:57
  • 1
    If for some reason you are unable to draw a single path as @DavidCarlisle suggested, you can add [line cap=round] to the \draw command, which will hide the gaps pretty well. Or you can add it to the \scope options, or to the entire tikzpicture.
    – Sandy G
    Dec 21, 2020 at 2:21

2 Answers 2

2

\draw[line width=1.5] (1,1) -- (0,0) -- plot [smooth, tension=1.5] coordinates{(0,0) (1,-1) (2,0)} -- cycle; is ok?

2
  • 2
    I think you do not need to double (0,0), i.e. \draw[line width=1.5] (1,1) -- plot [smooth, tension=1.5] coordinates{(0,0) (1,-1) (2,0)} -- cycle; is sufficient, but otherwise this is the correct answer.
    – user231225
    Dec 21, 2020 at 2:57
  • 1
    @user231225 You are right.
    – polyn
    Dec 21, 2020 at 6:39
2

Draw a single path as advised by @DavidCarlisle, and a simple arc will suffice for this semicircular part of the diagram, no need for a plot.

\documentclass[tikz,border=5pt]{standalone}

\begin{document}

\begin{tikzpicture} [line width=1.5]
  \draw (0,0) arc (-180:0:1) -- (1,1) -- cycle;
\end{tikzpicture}

\end{document}

enter image description here

1
  • Yes, the arc was just an example, it could also be a more complex curve.
    – Karlo
    Dec 21, 2020 at 15:40

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.