
正六角形の頂点にノード(辺なし)だけを描画しようとしています。この答え簡単に変更して目的を達成できるはずですが、初心者なので例を理解するのが困難です。理想的には、各頂点は別々の名前ノード間のエッジを簡単に描画できるようにします (これらの同じノードを使用して、いくつかの異なるグラフを作成します)。
答え1
regular polygon
ライブラリからシェイプshapes.geometric
を に設定して使用できますdraw=none
。ノードに という名前を付けるとa
、頂点には という名前が付けられますa.corner 1
。a.corner 2
\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}
\fill (a.corner \x) circle[radius=2pt];
\end{tikzpicture}
\end{document}
答え2
電話する時間です\foreach
。もちろん、他の多くのツールを使用することも可能です。
\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}
色を変更したい場合、他に可能なオプションがいくつかあります。
\draw[line width=.7pt,blue,fill=yellow] (\a:1.5cm) circle (2pt);
答え3
以下は PSTricks ソリューションです (いくつかの追加機能付き - 不要なコードを削除するか、コメントアウトするだけです)。
\documentclass{article}
\usepackage{
pst-poly,
pstricks-add
}
\usepackage[
% locale = DE,
round-mode = places,
round-precision = 2
]{siunitx}
\usepackage{xfp}
% calculations
\newcommand*\Angle{\fpeval{360/\sides}}
\newcommand*\sidelength{\fpeval{2*\radius*sin(pi/\sides)}}
\newcommand*\radiusI{\fpeval{\radius*cos(pi/\sides)}}
%\newcommand*\areaI{\fpeval{pi*\radiusI^2}}
%\newcommand*\areaC{\fpeval{pi*\radius^2}}
%\newcommand*\areaRatio{\fpeval{cos(pi/\sides)^2}}
\psset{dimen = m}
\begin{document}
% constants
\def\sides{6}
\def\radius{3.5}
\begin{center}
\begin{pspicture}(-\radius,-\radius)(\radius,\radius)
% centre
\pnode(0,0){C}
% regular polygon with dots at corners
\rput(C){%
\PstPolygon[
PolyNbSides = \sides,
unit = \radius
]
}
{\psset{linestyle = dashed}
% inscribed circle
\pscircle(C){\radiusI}
% circumscribed circle
\pscircle(C){\radius}}
% 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
](C)(\radius,0){1}{A}
\psdot[
linecolor = red
](\radius;\r)
\uput[\r](\radius;\r){$P_{\i}$}
}
% dot at centre
\psdot[
linecolor = blue!60
](C)
% label position
\pcline[
linestyle = none,
offset = 9pt
](C)(\radius,0)
% 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}
答え4
PSTricks を使用した推奨ソリューション。にn
は - 辺のポリゴンが必要であることn+1
に注意してください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}
注記
\curvepnodes
( で実装) には、 ( で実装)pst-node
が必要です。実装は、内部でロードして使用可能にする必要があるため、私見では少し奇妙に思えます。 plotpoints
pst-plot
pst-node
\curvepnodes
pst-plot
plotpoints
その他
\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}