How to make line join circle node perfectly

Anohter option is to simply connect the center points and then redraw with a fill=white option, or, as per marmot's suggestion, you can do the drawing all at once:

enter image description here

Code:

\documentclass[preview, border=0.5pt]{standalone}
\usepackage{tikz}

\tikzset{Node Style/.style={thick, draw,fill=white,circle,inner sep=0pt,minimum size=3pt}}

\begin{document}
\begin{tikzpicture}
\node (leftEnd)  at (0,0)   [Node Style] {};
\node (rightEnd) at (0.3,0) [Node Style] {};

\draw [ultra thick] (leftEnd.center) -- (rightEnd.center);

\node (leftEnd)  at (0,0)   [Node Style] {};
\node (rightEnd) at (0.3,0) [Node Style] {};
\end{tikzpicture}
%
\begin{tikzpicture}
\draw[ultra thick] 
       (0,0)   node[Node Style] {} 
    -- (0.3,0) node[Node Style] {};
\end{tikzpicture}%
\end{document}

You can adjust the shorten value ,shorten >=1.5pt,shorten <=1.5pt, or use the arrows.meta library to get the same result.

RESULT: Zoom 1000%

enter image description here

MWE:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
    >={Circle[fill=none,length=3.5pt,line width=0.5]}
]
\node (leftEnd) at (0,0) [draw,circle,inner sep=0pt,minimum size=3pt] {};
\node (rightEnd) at (0.3,0) [draw,circle,inner sep=0pt,minimum size=3pt] {};
\draw[ultra thick,shorten >=1.5pt,shorten <=1.5pt] (leftEnd.center) -- (rightEnd.center);
\draw[ultra thick,<->,shorten >=-1.75pt,shorten <=-1.75pt] (0,-10pt) -- ++(0.3,0);

\end{tikzpicture}
\end{document}

to the some line width it helps if you set in nodes' style outer sep=0pt:

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
\begin{tikzpicture}[
circ/.style = {circle, draw, inner sep=0pt, minimum size=3pt, outer sep=0pt}
                    ]
\node (leftEnd)  [circ] {};
\node (rightEnd) [circ] at (0.5,0) {};
\draw[ultra thick] (leftEnd) -- (rightEnd);
\draw[line width=6pt, gray, semitransparent] (leftEnd) -- (rightEnd);
\end{tikzpicture}
\end{document}

enter image description here

Tags:

Tikz Pgf