4

I would like to produce a picture like this

Screen shot

How can I create the red arrows? I have managed to produce the large partitioned triangle and the samller colored triangles : enter image description here But I don't know of a good way to add the arrows. I would like them to be mostly parallel to the edges of the smaller triangles, and to bend smoothly at the corners.

Here is my code so far.

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=2]
\path
    (0,0) coordinate (0)
    (3,0) coordinate (1)
    ;
\path[rotate=60]
    (3,0) coordinate (2)
    ;
\path
    (0) -- (1) coordinate [midway] (01)
    (1) -- (2) coordinate [midway] (12)
    (0) -- (2) coordinate [midway] (02)
    ;
\draw[thick, fill=purple!50]
    (0) -- (01) -- (02) -- cycle
    ;
\draw[thick, fill=red!50]
    (1) -- (01) -- (02) -- cycle
    ;
\draw[thick, fill=orange!50]
    (1) -- (12) -- (02) -- cycle
    ;
\draw[thick, fill=yellow!50]
    (2) -- (12) -- (02) -- cycle
    ;
\draw
    (0) node [below left] {$0$}
    (1) node [below right] {$1$}
    (2) node [above] {$2$}
    %
    (01) node [below] {$[0,1]$}
    (12) node [above right] {$[1,2]$}
    (02) node [above left] {$[0,2]$}
    ;
\end{tikzpicture}
\end{document}

Thanks for the help!

4

You can use control syntax \draw (0)..controls (01)..(2); to create a curved arrow controlled by (01) coordinate, you need just manual adjustments of arrows ends and the control point with shift={(<xshift>,<yshift>)}

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=2,>=stealth]
\path
    (0,0) coordinate (0)
    (3,0) coordinate (1)
    ;
\path[rotate=60]
    (3,0) coordinate (2)
    ;
\path
    (0) -- (1) coordinate [midway] (01)
    (1) -- (2) coordinate [midway] (12)
    (0) -- (2) coordinate [midway] (02)
    ;
\draw[thick, fill=purple!50]
    (0) -- (01) -- (02) -- cycle
    ;
\draw[thick, fill=red!50]
    (1) -- (01) -- (02) -- cycle
    ;
\draw[thick, fill=orange!50]
    (1) -- (12) -- (02) -- cycle
    ;
\draw[thick, fill=yellow!50]
    (2) -- (12) -- (02) -- cycle
    ;
\draw
    (0) node [below left] {$0$}
    (1) node [below right] {$1$}
    (2) node [above] {$2$}
    %
    (01) node [below] {$[0,1]$}
    (12) node [above right] {$[1,2]$}
    (02) node [above left] {$[0,2]$}
    ;
\draw [->,thick] ([shift={(.2,.1)}]0) ..controls ([shift={(-.1,.1)}]01) ..([shift={(0,-.2)}]02) ;  
\draw [->,thick] ([shift={(-.3,.1)}]1)..controls ([shift={(.1,.1)}]01)  ..([shift={(.2,-.2)}]02);
\draw [->,thick] ([shift={(-.3,.3)}]1)..controls ([shift={(-.1,-.1)}]12)..([shift={(.4,-.1)}]02); 
\draw [->,thick] ([shift={(0,-.2)}]2) ..controls ([shift={(-.1,.1)}]12) ..([shift={(.2,.1)}]02) ;
\end{tikzpicture}
\end{document}
  • Thanks! This is very close to what I had in mind. How could you do this with the extra requirement that the arrows be as evenly placed as possible in the triangles? That is, rather than adding [shift={(x,y)}] for some specific x,y coordinates, you shift by the vector of length r and making an angle awith the horizontal? – Olivier Bégassat Jan 12 '17 at 21:11
  • You mean use of polar coordinate like shift={(a:r)} – Salim Bou Jan 12 '17 at 21:26
  • You can also add join=round to the tikzpicture to get better corners in this case. – Peter Grill Jan 12 '17 at 21:53
3

Here is another method using barycentric coordinate system and rounded corners:

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2,>=stealth,line join=round]
  \path (0,0) coordinate (0) (3,0) coordinate (1);
  \path[rotate=60] (3,0) coordinate (2);
  \path  (0) -- (1) coordinate [midway] (01)
         (1) -- (2) coordinate [midway] (12)
         (0) -- (2) coordinate [midway] (02);
  \tikzset{my fill/.style={thick,fill=#1}}
  \draw[my fill=purple!50] (0) -- (01) -- (02) -- cycle;
  \draw[my fill=red!50] (1) -- (01) -- (02) -- cycle;
  \draw[my fill=orange!50] (1) -- (12) -- (02) -- cycle;
  \draw[my fill=yellow!50] (2) -- (12) -- (02) -- cycle;
  \draw (0) node [below left] {$0$}
        (1) node [below right] {$1$}
        (2) node [above] {$2$}
        % 
       (01) node [below] {$[0,1]$}
       (12) node [above right] {$[1,2]$}
       (02) node [above left] {$[0,2]$};

  \tikzset{rounded arrow/.style={-stealth,thick,blue,rounded corners=5mm}}
  \newcommand\myarrows[3]{
       (barycentric cs:#1=10,#2=1,#3=1) 
    -- (barycentric cs:#1=1,#2=10,#3=1) 
    -- (barycentric cs:#1=1,#2=1,#3=10)
  }

  \draw [rounded arrow] \myarrows{0}{01}{02};
  \draw [rounded arrow] \myarrows{1}{01}{02};
  \draw [rounded arrow] \myarrows{1}{12}{02};
  \draw [rounded arrow] \myarrows{2}{12}{02};
\end{tikzpicture}
\end{document}

enter image description here

  • Thank you, barycentric coordinates are the better solution! I didn't even know they existed in tikz. – Olivier Bégassat Jan 13 '17 at 11:20

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.