TikZ - circle split ignore empty parts

This has already been asked at TikZ: Removing the inner line of circle split, rectangle split, etc., but not answered for circles:

How can I remove the split line in a picture where

every node/.style={circle split}


There is no such key as circle split ignore empty parts and I haven't found anything in the manual.

Is there any workaround?

-

With a new shape

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes,calc}
\makeatletter
\pgfdeclareshape{new circle split}
{
%
% Node parts
%
\nodeparts{text,lower}

%
% Anchors
%
\savedanchor\centerpoint{%
\pgf@x=.5\wd\pgfnodeparttextbox%
\pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
\pgf@y=-\pgf@y%
}%
\savedanchor\loweranchor{%
\pgf@x=-.5\wd\pgfnodepartlowerbox%
\pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
\pgf@y=-2\pgf@y%
}

%
% Caculate height radius''
%
%\pgf@ya=.5\ht\pgfnodeparttextbox%
%
% MW: Suggested correction for above calculation:   Use the tallest box * 2.
%
\pgf@ya=.5\ht\pgfnodeparttextbox%
\pgf@yb=.5\ht\pgfnodepartlowerbox%
\ifdim\pgf@ya>\pgf@yb\relax%
\pgf@ya2.0\pgf@ya\relax%
\else%
\pgf@ya2.0\pgf@yb\relax%
\fi%
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
%
% Caculate width radius''
%
\pgf@xa=.5\wd\pgfnodeparttextbox%
\ifdim\pgf@xa<.5\wd\pgfnodepartlowerbox%
\pgf@xa=.5\wd\pgfnodepartlowerbox%
\fi%
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
%
% Calculate length of radius vector:
%
\pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
\ifdim\pgf@x>\pgf@y%
\c@pgf@counta=\pgf@x%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@xa=16\pgf@xa\relax%
\divide\pgf@xa by\c@pgf@counta%
\pgf@xa=16\pgf@xa\relax%
\fi%
\else%
\c@pgf@counta=\pgf@y%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@ya=16\pgf@ya\relax%
\divide\pgf@ya by\c@pgf@counta%
\pgf@xa=16\pgf@ya\relax%
\fi%
\fi%
\pgf@x=\pgf@xa%
%
% met:
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgf@x<.5\pgf@xb%
\pgf@x=.5\pgf@xb%
\fi%
\ifdim\pgf@x<.5\pgf@yb%
\pgf@x=.5\pgf@yb%
\fi%
%
% Now, add larger of outer sepearations.
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\else%
\fi%
}

%
% Anchors
%
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{north east}
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{mid}
\inheritanchor[from=circle]{mid west}
\inheritanchor[from=circle]{mid east}
\inheritanchor[from=circle]{base}
\inheritanchor[from=circle]{base west}
\inheritanchor[from=circle]{base east}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{south west}
\inheritanchor[from=circle]{south east}
\anchor{lower}{\loweranchor}

%
% Background path
%
\inheritbackgroundpath[from=circle]
\beforebackgroundpath{
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\else%
\fi%
\pgfsetshortenstart{0pt}%
\pgfsetshortenend{0pt}%
\pgfsetarrows{-}%
\pgfusepath{stroke}%
}
}

\begin{document}

\begin{tikzpicture}
\node [new circle split,
draw,
minimum width=4cm,
append after command={%
}]
{top
\nodepart{lower}
below
};
\end{tikzpicture}

\end{document}


-
I had not expected that much code. If that's how I have to do it, I guess I'll just manually add the split each time I need it. Thank you a lot still. – IARI Jun 6 '12 at 22:28
It' possible to reduce the code but the idea is the same. You need to create a new shape. There are several examples on the tex.se like batman,etc. – Alain Matthes Jun 7 '12 at 6:33

I think there is a different approach. You can still achieve the same effect, but the object will not be a multipart node:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\node (A) [shape=circle,draw,matrix] at (0,0) {\node {Hello};\\ \node{World};\\};
\end{tikzpicture}
\end{document}


-
Thank you, but I did want to use multipart nodes: in a style and then let the nodes with that style automatically be rendered as multipart if they do have a nodepart and as regular circles as not. – IARI Jun 8 '12 at 15:08