How would I make a 16-gon only showing the vertices? I want to number the vertices and then connect certain ones with lines. I literally just started using TikZ in LaTeX so help would be appreciated.
-
7So you've started. Can you show us some of your code?– Werner ♦Sep 16, 2015 at 22:50
-
1Why does everyone assume the OP wants a regular 16-gon?– cfrSep 17, 2015 at 1:28
-
^ fair point @cfr . It's a reasonable assumption though. I've added a comment to my solution below that it can be adapted.– Andrew KepertSep 17, 2015 at 2:18
4 Answers
An n-gon showing only the vertices is a circle. So it won't make too much difference but TikZ has a geometric shapes library. To show only the vertices remove the draw
option from the first node.
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[regular polygon,regular polygon sides=16,minimum size=5cm,draw] (a){};
\foreach \x in {1,...,16}{\node[circle,fill,inner sep=1pt] at (a.corner \x) {};}
\end{tikzpicture}
\end{document}
-
14Congratulations percusse on reaching 100k.– user11232Sep 16, 2015 at 23:37
If you are connecting only certain vertices with edges, then something like this will do it:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \n in {0,...,15}
\fill (90-\n*22.5:2cm) coordinate (v\n) circle[radius=.5mm]
++(90-\n*22.5:10pt) node {\n};
\foreach \m/\n in {0/1,0/2,0/3,0/4,0/5,5/6,5/7,5/8,5/9,10/11,11/12,12/13,13/14,14/15,15/10}
\draw (v\n)--(v\m);
\end{tikzpicture}
\end{document}
-
... or if you want the vertices in something other than a regular hexadecagon, then specify the coordinates of the points (v0) ... (v15) in some other fashion. Sep 17, 2015 at 2:16
Here's an option using tkz-graph
:
The vertices are drawn using simply
\Vertices{circle}{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
Edges can be drawn using
\Edges(<list of vertices>)
A complete example:
\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
\begin{tikzpicture}
\SetGraphUnit{4}
\GraphInit[vstyle=Shade]
\Vertices{circle}{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
\Edges(1,6,11,16,5,10,15,4,9,14,3,8,13,2,7,12,1)
\end{tikzpicture}
\end{document}
Here is a pstricks
solution, with the pst-polygon
package. I didn't draw the sides of the hexadecagon, only the vertices:
\documentclass[x11names]{standalone}%
\usepackage{fourier}
\usepackage{pstricks-add}
\usepackage{pst-poly}
\usepackage{auto-pst-pdf}
\newpsobject{PstHexaDecagon}{PstPolygon}{PolyNbSides=16,PolyName=A}
\begin{document}
\footnotesize
\begin{pspicture}%
\providecommand{\PstPolygonNode}{%
\psdots[dotstyle=o, dotsize=2pt,fillstyle = solid, fillcolor=IndianRed3](1;\INode)}
\psset{ linewidth = 0.6pt}
\rput(0,0){\PstHexaDecagon[linestyle = none]}
\ncline[nodesep=1pt, linecolor=LightSteelBlue3]{A1}{A5}
\psset{labelsep=3pt}
\nput{0}{A1}{$A_1$}\nput{90}{A5}{$A_5$}
\end{pspicture}
\end{document}