# Draw Vertices of Regular Polygon

I am trying to draw just the nodes (no sides) at the vertices of a regular hexagon. This answer should be easily modified to accomplish what I want, but I am such a novice that I have difficulty understanding the example. Ideally, each vertex would be a separate named node so that I can easily draw edges between them (I will be making several different graphs using these same nodes).

-

You can use the regular polygon shape from the shapes.geometric library, setting draw=none. Giving the node the name a, the vertices will be named a.corner 1, a.corner 2 etc.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}

\begin{tikzpicture}
% create the node
\node[draw=none,minimum size=2cm,regular polygon,regular polygon sides=6] (a) {};

% draw a black dot in each vertex
\foreach \x in {1,2,...,6}

\end{tikzpicture}
\end{document}

-
If I want to draw a regular plolygons with label at vertices. How I can do? – minthao_2011 Jan 3 '14 at 5:41
@minthao_2011 Place nodes at a.corner 1 etc. See for example tex.stackexchange.com/questions/141668/… – Torbjørn T. Jan 3 '14 at 10:31

Time to call \foreach. Of course, it is possible to use a lot of other tools.

\documentclass[]{report}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\foreach \a in {0,60,...,300} { %\a is the angle variable
\draw[fill] (\a:2cm) circle (1pt); % 2cm is the radius; 1pt is the radius of the small bullet
}
\end{tikzpicture}
\end{document}


Here are some other possible options, if you want to change colors.

\draw[line width=.7pt,blue,fill=yellow] (\a:1.5cm) circle (2pt);


-
I like the simplicity of your code, but is there a way to modify it so that I have names for each of the created nodes? – Austin Mohr Jan 2 '14 at 22:31

Here is a PSTricks solution (with some extra features -- just remove the code not needed or outcomment it):

\documentclass{article}

\usepackage{
pst-poly,
}
\usepackage[
%  locale = DE,
round-mode = places,
round-precision = 2
]{siunitx}

\ExplSyntaxOn
\cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff

% calculations
\newcommand*\Angle{\calc{360/\sides}}
\newcommand*\areaRatio{\calc{cos(pi/\sides)^2}}% not used

\psset{dimen = m}

\begin{document}

% constants
\newcommand*\sides{6}

\begin{center}
% centre
\pnode(0,0){C}
% regular polygon with dots at corners
\rput(C){%
\PstPolygon[
PolyNbSides = \sides,
]
}
{\psset{linestyle = dashed}
% inscribed circle
% circumscribed circle
% dots with labels at the corners and lines from the centre to the corners
\multido{\r = 0+\Angle, \i = 1+1}{\sides}{
\psRelLine[
angle = \r,
linestyle = dotted
\psdot[
linecolor = red
\uput[\r](\radius;\r){$P_{\i}$}
}
% dot at centre
\psdot[
linecolor = blue!60
](C)
% label position
\pcline[
linestyle = none,
offset = 9pt
% label
\ncput{$r = \num[round-mode = off]{\radius}$}
\end{pspicture}
\end{center}

\bigskip

\noindent Regular $\sides$-gon with side length~$s = \num{\sidelength}$.

\end{document}


-
\psdot(\radius;\rA) – Herbert Jan 3 '14 at 12:22
Arrrh, yes. Thank you. I'll edit my answer accordingly. – Svend Tveskæg Jan 3 '14 at 12:24
you can also do \degrees[\sides] and then simply \multido{\iA=0+1}{\sides}{...} – Herbert Jan 3 '14 at 12:35

A recommended solution with PSTricks. Note that n-side polygon needs n+1 for the plotpoints.

\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}
\begin{document}
\begin{pspicture}(-2,-2)(2,2)
\curvepnodes[plotpoints=13]{0}{360}{2 t PtoC}{A}
\psnline[linestyle=none,showpoints](0,\Anodecount){A}
\end{pspicture}
\end{document}


## Note

\curvepnodes (implemented in pst-node) needs plotpoints (implemented in pst-plot). It seems to be a bit weird as IMHO, pst-node implementing \curvepnodes should load pst-plot internally to make plotpoints available.

## Miscellaneous

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-node,pst-plot}
\psset{saveNodeCoors}
\begin{document}
\begin{pspicture}(-2,-2)(2,2)
\curvepnodes[plotpoints=13]{0}{360}{2 t PtoC}{A}
\psnline[showpoints](0,\Anodecount){A}
\multido{\i=0+1}{\Anodecount}{\uput[!N-A\i.y N-A\i.x atan](A\i){$A_{\i}$}}
\end{pspicture}
\end{document}


-

Since someone added an tag, I'll go ahead and give an Asymptote solution. Note that the programming abilities of Asymptote have the following advantages:

1. You can store all the points in an array, which makes it easy to reference them.
2. It is easy and natural to create points for future reference without drawing them, if so desired.

\documentclass[margin=10pt]{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(3cm,0);    // scale the final picture to be 3cm wide
pair[] vertices;    // an empty array of points
int n = 11;    // number of sides
real r = 1.0;    // radius of the circle in which the polygon is inscribed
// Add the vertices to the array:
for (real angle = 0; angle < 360; angle += 360/n) {
// The push command adds its argument to the end of the array.
vertices.push(r*dir(angle));  // r*dir(angle) gives the point with polar coordinates (r, angle).
}
// Draw the vertices:
for (pair vertex : vertices)
dot(vertex);

// Draw a couple lines in respective colors:
draw(vertices[0] -- vertices[6], red);
draw(vertices[1] -- vertices[9], blue);
\end{asy}
\end{document}


The result:

-
Feel free to always add Asymptote solution to any questions related to plotting, drawing, diagramming, etc because it is allowed by law in this site. – kiss my armpit Jan 5 '14 at 21:33

For labels, you could try something like this based on the answer from Torbjørn T.:

\documentclass[]{report}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \a/\text in {0/A,60/B,120/C,180/D,240/E,300/F}
\draw[fill] (\a:2cm) circle (1pt) node[right] () {\text};
\end{tikzpicture}
\end{document}


which produces this

-