答案1
众多方法中的一种。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\foreach \X [count=\Y] in {red,red,blue,blue,green!70!black,green!70!black,green!70!black}
{\draw[color=\X] (-1,-0.7*\Y) node (L\Y) {L\Y} (1,-0.7*\Y) node (R\Y) {R\Y}
(L\Y) -- (R\Y); }
\foreach \X/\Z [evaluate=\X as \Y using {int(\X+1)}] in
{1/red,3/blue,5/green!70!black,6/green!70!black}
{\draw[color=\Z] (L\X) -- (R\Y) (L\Y) -- (R\X);}
\end{tikzpicture}
\end{document}