I think you want something like the right figure below, left and middle figure are the result form your codes.

Command \draw
just draws a path between provided coordinates, but it doesn't creates any labels for further reference. You need node
or coordinate
(an special kind of node
) to assign labels to certain points on your canvas which can be later on used to draw lines between them or place new elements.
Your first command
\draw[thin,ball color=red] (0,0) circle(0.4ex) node(mX1){};
draw a red ball on coordinate (0,0) and also draws
an invisible and empty node named mX1
on same coordinate. Change node (mX1) {}
to node[draw] (mX1) {}
to make it visible.
Second command
\draw[thin,ball color=white] (1,1) circle(0.4ex) node[left] (X1){$X_1$};
does something similar, it draw a white ball on (1,1)
but a node called X1
is placed to the left (1cm by default) of (1,1)
.
Line \draw (X1)--(mX1);
goes form X1
border to mX1
border. And although X1
node is at origin, mX1
is not on white ball center, but to the left of it.
Proposed solution
\node[circle, very thin, ball color=red!50, minimum size=0.8ex, inner sep=0pt] (mX1) at (0,0) {};
\node[circle, very thin, ball color=white!50, minimum size=0.8ex, label=left:$X_1$, inner sep=0pt] (X1) at (1,1) {};
draws balls as circular nodes. This way X1
and mX1
make reference to balls center. And label X_1
is set as a label
of second node. minimum size=0.8ex
fixes ball diamenter if inner sep=0pt
. This way line between nodes borders shows no separation from them.
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (1,1);
\draw[thin,ball color=red] (0,0) circle(0.4ex) node(mX1){};
\draw[thin,ball color=white] (1,1) circle(0.4ex) node[left] (X1){$X_1$};
\draw (X1)--(mX1);
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (1,1);
\draw[very thin,ball color=red!50] (0,0) circle(0.4ex) node(mX1){};
\draw[thin,ball color=white,label=X1] (1,1) circle(0.4ex) node{$X_1$};
\draw (X1)--(mX1);
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (1,1);
\node[circle, very thin, ball color=red!50, minimum size=0.8ex, inner sep=0pt] (mX1) at (0,0) {};
\node[circle, very thin, ball color=white!50, minimum size=0.8ex, label=left:$X_1$, inner sep=0pt] (X1) at (1,1) {};
\draw (X1)--(mX1);
\end{tikzpicture}
\end{document}
(mX1)
you are naming a node. If you just want to name the point, usecoordinate (mX1)
. Also note that you can easily draw from the center of the node, just usemX1.center
– daleif Sep 29 '15 at 10:38