TikZ Nodes not exactly centered

In my solution to draw a plot with point, it was pointed out that the nodes containing \textbullet and $\circ$ were not placed exactly centered at the specified point. I found this hard to believe but it does indeed appear to be the case.

Here is an image magnified to 2400% which shows this. The left pictures is:

\node [red] at (0,0) {\textbullet};
\draw [brown]  (0,0) circle (3pt);


and the right is:

\node [blue] at (1,0) {$\circ$};
\draw [brown]   (1,0) circle (3pt);


Clearly both are not centered at the given point.

Questions:

1. I though that nodes were centered by default so what is different in this case?
2. How would you ensure that these are placed with their centers at the specified point?

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw [very thin, gray] (-1,-1) grid (2,1);

\node [red] at (0,0) {\textbullet};
\draw [brown]  (0,0) circle (3pt);

\node [blue] at (1,0) {$\circ$};
\draw [brown]   (1,0) circle (3pt);
\end{tikzpicture}
\end{document}


The bounding box of a character always includes the baseline point:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \txt[count=\c] in {\textbullet,$\circ$,',x}{
\node [inner sep=0pt,draw=red,line width=.1pt,text=violet](a) at (.25*\c,0) {\txt};
\draw [brown]  (.25*\c,0) circle (3pt);
}
\end{tikzpicture}
\end{document}


Question 1 : My last example shows that the nodes are correctly centered and in your examples, if you use the option draw, you can see that the nodes are correctly centered too. The anchor used is (center) but if you put a text inside your node, the position of the text depends on the baseline.

Question 2 : It's easy to place a drawing exactly at the center of a node but a character is not symmetric and the baseline depends on the character. Your problem here is to determine if your character is symmetric and where is the baseline.

If you look at the last circle, $\circ$ is not correctly centered. In the four try the box with p$\circ$b is correctly centered vertically but not horizontally.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw [very thin, gray] (-1,-1) grid (5,1);

\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (0,0) {$\circ$};
\draw [brown]  (0,0) circle (3pt);

\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (1,0) {p$\circ$ };
\draw [brown]   (1,0) circle (3pt);

\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (2,0) {$\circ$b };
\draw [brown]   (2,0) circle (3pt);

\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (3,0) {p$\circ$b };
\draw [brown]   (3,0) circle (3pt);

\node [blue,draw,circle,minimum  size=10pt,anchor=text] at (4,0) {p$\circ$b };
\draw [brown]   (4,0) circle (3pt);
\end{tikzpicture}

\end{document}


I built a box (here a square correctly centered). It's more easy to see that the square is correctly centered. The last picture too but not $\circ$. When you used a character, this character is in a box with a baseline and the position of the character inside the node depends of the baseline.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw [very thin, gray] (-1,-1) grid (5,1);
\def\tvi{\vrule height 4pt depth 4pt width 8pt}

\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (0,0) {\tvi};
\draw [red]  (0,0) circle (3pt);

\def\tvi{\vrule height 4pt depth 4pt width 1pt}
\node [blue,draw,circle,minimum  size=10pt,anchor=center] at (1,0) {\tvi$\circ$\tvi};
\draw [red]  (1,0) circle (3pt);

\end{tikzpicture}

\end{document}


​​​​​​​​​​

• Impressive... :-) – Daniel Jun 27 '12 at 11:18
• A picture is worth a thousand word! ;-) – Paul Gaborit Jun 27 '12 at 12:04
• Since code only answers are frowned upon, shouldn't image only ones be too? :-) Wondering if this is the first image only answer. – Peter Grill Jul 3 '12 at 21:13
• Old but code is still missing :(. Can you add the code of your answer. – Bobyandbob Mar 6 '17 at 12:18
• @Bobyandbob This was not an answer to the question. The purpose of this was to demonstrate very clearly that the \circ circle was above the baseline, a crucial point in the actual answers. As such, it complements the existing answers but does not stand by itself. I wouldn't have posted this without proper answers already existing. Posting the code would be pointless as it is irrelevant to solving the problem. – Andrew Stacey Mar 6 '17 at 20:19