# Draw polytope with Graphics

How can I draw a polytope with the Graphics function? The documentation simply says that you can do it, but does not explain how. The example given only plots vertices, not the edges of the polytope. Using:

Graphics[Octagon]


gives an error. I also tried the following from a different question:

Graphics[Octagon & /@ Vertices[Octagon]]


and that does not work either. I also tried the following:

Graphics[Line[{{0, 0}, #}] & /@ Vertices[Octagon]]


and that does not work either. I also tried this:

Graphics[Line[{{0, 0}, #}] & /@ EdgeList[Octagon]]


and that gives an error as well. I also tried this:

Graphics[Line[{{0, 0}, #}] & /@ Faces[Octagon]]


and that does not work. It would be useful to have an answer that explains how this stuff works, because I just don't get it and the documentation does not explain enough that I can figure out the internal logic of these functions. The documentation page on Polytopes says it is a "tutorial", but there is no tutorial. It just lists the functions and then gives four short examples.

I almost got it to work with this:

Graphics[Line[Vertices[Octagon]]]


But it does not close up the last point.

• Graphics[{Red, RegularPolygon, White, Text[Style["STOP", 110]]}] Oct 14 '16 at 16:32
• Nothing in the documentation for the Polytopes Package says you can use it with Graphics. But this seems to work Graphics@Polygon@Vertices@Octagon Oct 14 '16 at 16:36
• you mean this?
– yode
Oct 14 '16 at 16:37
• @yode - that is really odd. If you look at the resulting Graphics, you see they are using 1070 vertices to make an octagon!!! Oct 14 '16 at 16:41
• If what you want is the outline of a polytope: Graphics[{Black, RegularPolygon[1, 8], White, RegularPolygon[0.95, 8]}] Oct 14 '16 at 18:49

I figured out a way to do this, maybe not optimal, but it does work:

Graphics[Line[Append[Vertices[Octagon], First[Vertices[Octagon]]]]]


which produces: Vertices produces a list of x-y coordinates and Line builds a list of line objects for each of the vertices in a chain. You have to append the coordinates of the first vertice to the end of the list so that the last vertice connects to the first one and closes the figure.

Note that Polygon does not solve the problem economically because it does not generate a figure of lines, it generates a region.

• Try Graphics[{FaceForm[None], EdgeForm[Black], Polygon[Vertices[Octagon]]}], or Graphics[Line[{##, #1} & @@ Vertices[Octagon]]]. Oct 15 '16 at 2:43