How set TikZ circle radius in \node[circle]?
Interesting, here a test of the commands, according to what I found that the dimension of the shapes in text nodes, in this case circle, depends on the text_node_content_shape_dimmension
+ the_internal_separation (inner sep)
; as it defines itself the minimum size
, it would only define the size if the dimension of the text + the internal separation are less than the minimum size
; In this way, if we want to ensure that the dimension of the shape is determined by the minimum size
, the value of the internal separation must subtract from the value corresponding to the text so that both summations are lower than the minimun size
.
RESULT: Multiple option-results to see how the controls works for shape size even if it contains text.
MWE:
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
>={Stealth[inset=0pt,length=2pt]},
line width=0.1pt,
fill opacity=0.2,
text opacity=1,
]
%Grid in pt units
\draw[black!30,step=1pt] (0,0) grid (30pt,-120pt);
\draw[black!80,step=10pt,line width=0.2pt] (0,0) grid (30pt,-120pt);
\draw[|-|,line width=0.2pt] (0,0)++(0,3pt)-- ++(10pt,0) node[midway](n){};
\draw[<-] (n.center) |- ++(10pt,5pt) node [anchor=180, inner sep=0pt]{\tiny \verb+10pt+};
%Drawing a shape
\draw[fill]
(15pt,-5pt)
circle (3pt)
++ (15pt,0)
node[anchor=180, font=\tiny]{\verb+\draw[fill](x,y) circle (3pt);+};
%Drawing a node
\draw[blue]
(15pt,-15pt)
node [fill,draw,circle,label=below left:$x$]{}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$x$]at(x,y){};+};
\draw[blue!50!cyan]
(15pt,-25pt)
node [fill,draw,circle,label=below left:$x$] {$x$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$x$]at(x,y){$x$};+};
\draw[green!50!blue]
(15pt,-35pt)
node [fill,draw,circle,label=below left:$x$, inner sep=0pt] {$x$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$x$,inner sep=0pt]at(x,y){$x$};+};
\draw[green!50!black]
(15pt,-45pt)
node [fill,draw,circle,label=below left:$h$, inner sep=0pt] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,inner sep=0pt]at(x,y){$h$};+};
\draw[green!50!orange]
(15pt,-55pt)
node [fill,draw,circle,label=below left:$h$,inner sep=-1pt] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,inner sep=-1pt]at(x,y){$h$};+};
\draw[orange]
(15pt,-65pt)
node [fill,draw,circle,label=below left:$h$,minimum size=6pt] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,minimum size=6pt]at(x,y){$h$};+};
\draw[red]
(15pt,-75pt)
node [fill,draw,circle,label=below left:$h$,minimum size=6pt, inner sep=0pt] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,minimum size=6pt,inner sep=0pt]at(x,y){$h$};+};
\draw[red!50!black]
(15pt,-85pt)
node [fill,draw,circle,label=below left:$h$, inner sep=-2] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,inner sep=-2]at(x,y){$h$};+};
\draw[blue!50!black]
(15pt,-95pt)
node [fill,draw,circle,label=below left:$h$,minimum size=6, inner sep=-2] {$h$}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,minimum size=6,inner sep=-2]at(x,y){$h$};+};
\draw[blue!50!purple]
(15pt,-105pt)
node [fill,draw,circle,label=below left:$h$,minimum size=6, inner sep=-2] {}
++(15pt,0)
node[anchor=180, font=\tiny]{\verb+\node[fill,draw,circle,label=below left:$h$,minimum size=6,inner sep=-2]at(x,y){};+};
\draw[densely dashed]
(12pt,0) -- ++(0,-125pt)
(18pt,0) -- ++(0,-125pt);
\draw[|-|,line width=0.2pt] (0,-120pt)++(12pt,-4pt)-- ++(6pt,0) node[midway](n){};
\draw[<-] (n.center) |- ++(10pt,-5pt) node [anchor=180, inner sep=0pt]{\tiny \verb+6pt+};
\end{tikzpicture}
\end{document}
PSD:
- Result scale is 3.5;
- In the code I use:
\draw[draw_style_opt](coordinate) node[node_style_opt]{node_text_content}
; instead\node[node_style_opt] at (coordinate) {node_text_content}
; becausedraw_style_opt
affects all styles within command line.
at node with circle shape is radius equal to minimum size
/2, of course if you set inner sep
to zero. node features can define local at node or as new style with tikzpicture
options or globally with tikzset
in preamble of a document. for example:
\documentclass[tikz, margin=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[
dot/.style = {circle, fill, minimum size=#1,
inner sep=0pt, outer sep=0pt},
dot/.default = 6pt % size of the circle diameter
]
\node[dot,label=below left:radius 3pt] at (0,0) {};
\node[dot=5pt,label=below left:radius 5pt] at (3,0) {};
\draw[red, semitransparent] (0,0) circle[radius=3pt];% test of the radius size
\end{tikzpicture}
\end{document}
or
\documentclass[tikz, margin=3mm]{standalone}
\tikzset{
dot/.style = {circle, fill, minimum size=#1,
inner sep=0pt, outer sep=0pt},
dot/.default = 6pt % size of the circle diameter
}
\begin{document}
\begin{tikzpicture} ]
\node[dot,label=below left:radius 3pt] at (0,0) {};
\node[dot=10pt,label=below left:radius 5pt] at (3,0) {};
\draw[red, semitransparent] (0,0) circle[radius=3pt];% test of the radius size
\end{tikzpicture}
\end{document}