3

I've made a bubble diagram with 4 bubbles around the central bubble. But they're in a "cross" appearance, the 4 bubbles are shown in positions N, S, E and W. I'd like to rotate the surrounding bubbles, making them look more like an "X", or, in the positions NE, SE, NW and SW. Any suggestions?

  • Welcome to TeX.SE! Please, be so kind and show us what you do so far. You may find, that drawing it as pure TikZ picture is the simple way to draw your diagram. – Zarko Jul 07 '21 at 02:54
  • Can you provide a hand-drawing image ? – Black Mild Jul 07 '21 at 06:35

2 Answers2

5

This is not supported natively, but it is also not difficult to get a workaround.

\documentclass[border=2mm]{standalone}
\usepackage{smartdiagram}

\makeatletter \NewDocumentCommand{\smartdiagramx}{r[] m}{% \StrCut{#1}{:}\diagramtype\option \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram \begin{tikzpicture}[every node/.style={align=center,let hypenation}] \foreach \smitem [count=\xi] in {#2}{% \global\let\maxsmitem\xi% }% \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} \foreach \smitem [count=\xi] in {#2}{% \ifnumequal{\xi}{1}{%true \node[bubble center node](center bubble){\smitem}; }{%false \pgfmathtruncatemacro{\xj}{\xi-1} \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj+\option} \edef\col{@nameuse{color@\xj}} \node[bubble node] (module\xi) at (center bubble.\angle) {\smitem }; }% }% \end{tikzpicture} }{}%end if }% end command \makeatother

\begin{document} \smartdiagramx[bubble diagram:45]{Build a program,Set up,Run,Analyze,Modify~/\ Add} \end{document}

The result:

enter image description here

Use the option part after the type of diagram (e.g., bubble diagram:45) to include the shift angle with respect to the original placement.

As requested in the edit, this trick works also for presentation mode:

\documentclass{beamer}
\usepackage{smartdiagram}

\makeatletter \NewDocumentCommand{\smartdiagramanimatedx}{r[] m}{% \StrCut{#1}{:}\diagramtype\option \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram \begin{tikzpicture}[every node/.style={align=center,let hypenation}] \foreach \smitem [count=\xi] in {#2}{% \global\let\maxsmitem\xi% }% \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} \foreach \smitem [count=\xi] in {#2}{% \ifnumequal{\xi}{1}{%true \node[bubble center node, smvisible on=<\xi->](center bubble){\smitem}; }{%false \pgfmathtruncatemacro{\xj}{\xi-1} \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj+\option} \edef\col{@nameuse{color@\xj}} \node[bubble node, smvisible on=<\xi->] (module\xi) at (center bubble.\angle) {\smitem }; }% }% \end{tikzpicture} }{}%end if }% end command \makeatother

\begin{document} \begin{frame}{example} \smartdiagramanimatedx[bubble diagram:45]{Build a program,Set up,Run,Analyze,Modify~/\ Add} \end{frame} \end{document}

The result:

enter image description here

  • This is amazing. It was exactly what I was searching for. I was wondering if it would work in an animated smart diagram, to show one bubble each time, in case of a beamer presentation. – Rafael Barbosa da Silva Jul 07 '21 at 21:24
  • 1
    @RafaelBarbosadaSilva: Yes, see the updated reply. – Claudio Fiandrino Jul 08 '21 at 07:16
  • You really are an exceptional person! As a maintainer of the package, bringing these clarifications is of great relevance to our community. It's awesome to hear directly from the creator of the package. A big thank you! – Rafael Barbosa da Silva Jul 08 '21 at 13:38
3
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{mindmap}
\begin{document}
\begin{tikzpicture}[mindmap, concept color=red!40]
\node [concept] {Bubble}
    child[grow=45] {node[concept] {Bubble 1}}
    child[grow=135] {node[concept] {Bubble 2}}
    child[grow=225] {node[concept] {Bubble 3}}
    child[grow=-45] {node[concept] {Bubble 4}};
\end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588