1

How can I construct the following hexagon in tikz?

enter image description here

For now I tried:

\begin{tikzpicture}[]
\foreach \l [count=\n] in {text,text,text,text,text,text}
{\pgfmathsetmacro\angle{90-360/6*(\n-1)}
\node[label={\angle:\l}] (n\n) at (\angle:1) {};}
\draw[dashed] (n2) -- (n4) -- (n6) -- (n2);
\draw[dotted] (n1) -- (n3) -- (n5) -- (n1);
\draw[->] (n2) -- (n1);
\draw[->] (n2) -- (n3);
\draw[->] (n4) -- (n3);
\draw[->] (n4) -- (n5);
\draw[->] (n6) -- (n5);
\draw[->] (n6) -- (n1);
\draw[>-<] (n1) -- (n4);
\draw[>-<] (n2) -- (n5);
\draw[>-<] (n3) -- (n6);
\end{tikzpicture}
  • Whar you try so far? Heksagon you can draw by use of regular polygon shape from shapes.geometric library. – Zarko Aug 13 at 11:52
  • I used \foreach \x/\l/\p in { 30/{(text}/above, 90/{text}/above, 150/{text}/left, 210/{text}/below, 270/{text}/below, 330/{text}/right} but I don't know how i can draw the arrows or how to position the text according to the picture. – philipp_th Aug 13 at 12:00
  • 1
    Please ad this code to your question. For drawing arrows you need to name a coordinates of polygon corners. – Zarko Aug 13 at 12:34
  • Thanks, I just did that. How can I name the polygon coordinates? – philipp_th Aug 13 at 12:46
  • Please, give a fully compilable code. – AndréC Aug 13 at 13:00
5

Probably not the most elegant way... but it works:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[
    implikation/.style={stealth-stealth, thick},
    disjunktion/.style={dotted},
    exklusion/.style={dashed},
    kontravalenz/.style={>-<, shorten >=5pt, shorten <=5pt},
]
    \foreach[count=\i from 1] \txt/\pos in {%
        verboten/right,%
        pflichtig/above,%
        geboten/left,%
        {(relativ)\\erlaubt}/left,%
        {indifferent\\(absolut) erlaubt}/below,%
        {ungeboten\\(freigestellt)}/right%
    }{
        \coordinate[label={[align=center]\pos:\txt}] (node-\i) at ({60*\i-30}:2.5cm) {};
    }

    \draw[exklusion] (node-1) -- (node-3) -- (node-5) -- (node-1);
    \draw[disjunktion] (node-2) -- (node-4) -- (node-6) -- (node-2);

    \foreach \from/\to in {1/4, 2/5, 3/6}{
        \draw[kontravalenz] (node-\from) -- (node-\to);
    }

    \foreach \i/\j/\k in {6/1/2, 2/3/4, 4/5/6}{
        \draw[implikation] (node-\i) -- (node-\j) -- (node-\k);
    }

    \begin{scope}[shift={(-3,-4)}]
        \foreach \xpos/\ypos/\name/\style in {%
            0/0/Implikation/implikation,%
            3.5/0/Disjunktion/disjunktion,%
            0/-0.5/Exklusion/exklusion,%
            3.5/-0.5/Kontravalenz/kontravalenz%
        }{
            \draw[\style] (\xpos,\ypos) -- ++(0.8,0) node[right] {$=${} \name};
        }
    \end{scope}
\end{tikzpicture}
\end{document}

| improve this answer | |
  • Thank you very much for your help. How can I add a key as shown in the original picture? – philipp_th Aug 13 at 13:40
  • @philipp_th please see my latest edit. – Wulle Aug 13 at 17:36
  • U can give the background ... – Nguyen Van Justonly Chi Aug 13 at 17:56
  • Thank you very much! – philipp_th Aug 14 at 7:36

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.