# Help with diagram (tikz) of permutohedron/truncated octahedron [duplicate]

What is an easy way to reproduce this diagram?

I can sort of make it Bruteforce using tikzpicture

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw   (315.8,328.9) -- (268.85,410.22) -- (174.95,410.22) -- (128,328.9) -- (174.95,247.58) -- (268.85,247.58) -- cycle ;
\draw    (315.8,328.9) -- (358,272) ;
\draw    (318,212) -- (358,272) ;
\draw    (318,212) -- (268.85,247.58) ;
\draw    (428,252) -- (358,272) ;
\draw    (428,252) -- (420,300) ;
\draw    (420,300) -- (350,370) ;
\draw    (408,152) -- (428,252) ;
\draw    (338,102) -- (408,152) ;
\draw    (278,132) -- (318,212) ;
\draw    (171.4,132) -- (278,132) ;
\draw    (78,232) -- (128,328.9) ;
\draw    (78,232) -- (171.4,132) ;
\draw    (138,172) -- (174.95,247.58) ;
\draw    (338,102) -- (278,132) ;
\draw    (171.4,132) -- (240,100) ;
\draw    (240,100) -- (338,102) ;
\draw    (268.85,410.22) -- (350,370) ;
\end{tikzpicture}


I am wondering if there are more elegant ways to do it.

• Out of curiosity, is your code generated by another software? Aug 19, 2021 at 1:03
• The easiest way is to scan it. I've drawn something like this before, but can't remember the name of the shape. Aug 19, 2021 at 1:37
• @Dr.ManuelKuehner, no I just used help lines grid and used some geometry to get the coordinates for those two hexagons and other coordinates are mostly just guessed. Aug 19, 2021 at 12:19

There are various ways to plot the order 4 permutohedron, which is really a truncated octahedron. One standard set of coordinates is {(0,±1,±2), (0,±2,±1), (±1,0,±2), (±2,0,±1), (±1,±2,0), (±2,±1,0)}. So we set those coordinates and draw:

Here is the code to get you started. You can add labels, color, shading, hidden edges, change perspective, etc.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[z={(0,0,.5)}, line join=round]
\foreach [var=\x, var=\y, var=\z, count=\n] in {
2/1/0,2/0/1,2/-1/0,2/0/-1,
1/0/2,0/1/2,-1/0/2,0/-1/2,
1/2/0,0/2/1,-1/2/0,0/2/-1,
-2/1/0,-2/0/1,-2/-1/0,-2/0/-1,
1/0/-2,0/1/-2,-1/0/-2,0/-1/-2,
1/-2/0,0/-2/1,-1/-2/0,0/-2/-1
}{\coordinate (n\n) at (\x,\y,\z);}
\draw (n1)--(n2)--(n3)--(n4)--cycle;
\draw (n5)--(n6)--(n7)--(n8)--cycle;
\draw (n9)--(n10)--(n11)--(n12)--cycle;
\draw (n21)--(n22)--(n23);
\draw (n13)--(n14)--(n15);
\draw (n6)--(n10);
\draw (n2)--(n5);
\draw (n8)--(n22);
\draw (n15)--(n23);
\draw (n7)--(n14);
\draw (n11)--(n13);
\draw (n1)--(n9);
\draw (n3)--(n21);
\end{tikzpicture}

\end{document}


This is rather opinion based. If the shape of the graph should exactly look like the one you have made, you may already have a good solution.

This is how I would approach a problem if I want to reduce the code: Drawing with the coordinates in a foreach loop. Of course it is very cumbersome to enter all the coordinates.

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]

\draw[line width=0.5mm, black ] (315.8,328.9)
\foreach \x/\y in {315.8/328.9,268.85/410.22,174.95/410.22,128/328.9,174.95/247.58,268.85/247.58,315.8/328.9,358/272,318/212,268.85/247.58}
{-- (\x,\y)};
\end{tikzpicture}

\end{document}