2

I am trying to add additional nodes either side of a diagram produced using smartdiagram. Ideally, I would like node b1 placed to the left of the edge between a and b in the circular diagram, and b2 to the right of the edge between a and d. Using absolute coordinates to increase the distance between the additional nodes / try to place them still results in the circular diagram to the right of both nodes. Can this be done please?


My example code

\documentclass[border=10pt]{standalone}
\usepackage{tikz, smartdiagram}
\usetikzlibrary{shapes.multipart}    
\tikzset{
state/.style={rectangle split, draw=black, text width=3cm}
}

\begin{document}

\begin{tikzpicture}[node distance = 4cm, auto]  
  \node [state, rectangle split parts=2] (b1) at (0,5) {text \nodepart{two} one};
  \node [state, rectangle split parts=2] (b2) at (5,5) {text \nodepart{two} two};
\end{tikzpicture}    

\smartdiagram[circular diagram] {a, b, c, d}  

\end{document}

I thought maybe TikZ: adding nodes to a circular diagram from smartdiagram package could help but I can't see how to add the nodes i.e.

\smartdiagramadd[circular diagram]{a, b, c, d}{
              left of module1/\node [state, rectangle split parts=2]}
2

smartdiagram gives the nodes names. You can thus connect them using overlay. The IMHO only less appealing aspect of this is that things drawn in overlay mode do not increase the bounding box, which you need to do by hand. This explains the \hspace*{2cm} in

\documentclass[border=10pt]{standalone}
\usepackage{tikz, smartdiagram}
\usetikzlibrary{shapes.multipart}    
\tikzset{
state/.style={rectangle split, draw=black, text width=3cm}
}
\tikzset{every picture/.append style={remember picture}}
\begin{document}

\hspace*{2cm}\smartdiagram[circular diagram] {a, b, c, d}\hspace*{2cm}%
\begin{tikzpicture}[overlay]  
  \path (module1) -- (module2) node[midway,above left=1cm,state, rectangle split parts=2] (b1) at (0,5) {text \nodepart{two} one};
  \path (module1) -- (module4) node [midway,above right=1cm,state, rectangle split parts=2] (b2) at (5,5) {text \nodepart{two} two};
\end{tikzpicture}    


\end{document}

enter image description here

  • Thank you , this looks great (I had managed to do something in completely in tikz, but the paths were all just a bit crude i.e. using bend right -- this looks much better). I hadn't heard of overlay but I'll read up Thanks again. – user20650 Jan 20 at 23:28
  • 1
    You're welcome! (Sometimes arcs look better than bend right. In principle you can look up all definitions in the very nice manual of smartdiagram, which is how I learned that the names moduleN with integer N, but if the diagram already looks like you want to have it, you may not want to reinvent it. ;-) – marmot Jan 20 at 23:35
  • Dear @marmot; apologies for the follow-up I couldn't find how to do this, but how do you increase the vertical space as well i.e.\hspace*{8cm}\vspace{8cm} doesn't work. – user20650 Jan 21 at 8:55
  • ... seems I can accomplish this with border=50pt -- but of a hack im sure – user20650 Jan 21 at 9:18
  • 1
    @user20650 another way is \begin{tabular}{c} ~\\[3cm] \hspace*{2cm}\smartdiagram[circular diagram] {a, b, c, d}\hspace*{2cm}\\[3cm] \end{tabular} ... (also) not too beautiful – marmot Jan 21 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.