7

I am trying to have 2 thin lines and 1 thick line join each other in the middle, with a smooth transition from the thin lines to the thick one. Currently, this looks like this:

enter image description here

Is there a way to have the thin lines join into the thicker one more smoothly? For example, I am imagining the lines to enter at the top and at the bottom of the thicker line, effectively melding into each other.

Using this code:

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

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[-, ultra thick] (0,2) -- (1,2.5) -- (0,3);
    \draw[-, line width=2mm]  (1,2.5) to (2,2.5);
\end{tikzpicture}
\end{document}
mSSM
  • 3,152
  • Sort of related, but possibly overkill: https://tex.stackexchange.com/questions/40159/how-to-draw-a-sankey-diagram-using-tikz – Torbjørn T. May 30 '17 at 11:56
  • That's a great link, thank you! Naturally, using my search terms I didn't find that one. – mSSM May 30 '17 at 12:03

2 Answers2

10

If you make sure the thin line width is half the thick line, you can use a to path with appropriate angles and coordinates.

enter image description here

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

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[-, line width=1mm] (0,2) to[out=30,in=180] (1,2.5cm-0.5mm) ++(0,1mm) to[out=180,in=-30] (0,3);
    \draw[-, line width=2mm]  (1,2.5) to (2,2.5);
\end{tikzpicture}
\end{document}
Torbjørn T.
  • 206,688
  • Is there any difference between to and --? – Display Name Aug 18 '17 at 02:21
  • 1
    @SinglePackAbs You can't set the angles (out and in) like I did here with --. In general, to is more sophisticated than --, see section 14.13 The To Path Operation in the manual, and e.g. https://tex.stackexchange.com/a/55069/ for one example – Torbjørn T. Aug 18 '17 at 05:35
5

The following doesn't look too bad (but is in no way automated):

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

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw[-, line width=1mm] (0,2) to (1,2.5);
    \draw[-, line width=1mm] (0,3) to (1,2.5);
    \draw[-, line width=2mm]  (0.9,2.5) to (2,2.5);
\end{tikzpicture}
\end{document}

enter image description here

Skillmon
  • 60,462