# Create custom node to draw this

I'm very very new to tikz, I've already done this:

With this code:

\documentclass{article}

\usepackage[spanish,es-noquoting]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,intersections}

\begin{document}
\begin{tikzpicture}[terminal/.style={draw, drop shadow, fill=white, rectangle, inner sep=5pt, font=\bfseries, align=center}]
\tikzset{fallastyle/.style={text=red}}
\tikzset{pasastyle/.style={text=green}}
\def \margin {20} % margin in angles, depends on the radius

\path[name path=circulo] (0, 0) circle (\radius);

\node(correr_prueba)[name path=path_correr_prueba, terminal] at ({300+90}:\radius){Correr\\ Prueba};
\node(escribir_codigo)[name path=path_escribir_codigo, terminal] at ({240+90}:\radius){Escribir\\ Código};
\node(correr_todas_pruebas_1)[name path=path_correr_todas_pruebas_1, terminal] at ({180+90}:\radius){Correr todas\\ las pruebas};
\node(correr_todas_pruebas_2)[name path=path_correr_todas_pruebas_2, terminal] at ({60+90}:\radius){Correr todas\\ las pruebas};

\node (start) [node distance=8mm and -1mm, above left=of escribir_prueba, circle, fill=black, minimum width=1pt]{};

% INTERSECCIONES
\path [name intersections={of=circulo and path_escribir_prueba,name=intESCRIBIRPRUEBA}];
\def \ESCRIBIRRIGHT {intESCRIBIRPRUEBA-1}
\def \ESCRIBIRLEFT {intESCRIBIRPRUEBA-2}

\path [name intersections={of=circulo and path_correr_prueba,name=intCORRERPRUEBA}];
\def \CORRERPRUEBAUP {intCORRERPRUEBA-1}

\path [name intersections={of=circulo and path_escribir_codigo,name=intESCRIBIRCODIGO}];
\def \ESCRIBIRCODIGOUP {intESCRIBIRCODIGO-1}
\def \ESCRIBIRCODIGODOWN {intESCRIBIRCODIGO-2}

\path [name intersections={of=circulo and path_correr_todas_pruebas_1,name=intCORRERTODASPRUEBASFIRST}];
\def \CORRERTODASPRUEBASFIRSTLEFT {intCORRERTODASPRUEBASFIRST-1}
\def \CORRERTODASPRUEBASFIRSTRIGHT {intCORRERTODASPRUEBASFIRST-2}

\path [name intersections={of=circulo and path_refactorizar,name=intREFACTORIZAR}];
\def \REFACTORIZARUP {intREFACTORIZAR-1}
\def \REFACTORIZARDOWN {intREFACTORIZAR-2}

\path [name intersections={of=circulo and path_correr_todas_pruebas_2,name=intCORRERTODASPRUEBASSECOND}];
\def \CORRERTODASPRUEBASSECONDUP {intCORRERTODASPRUEBASSECOND-1}
\def \CORRERTODASPRUEBASSECONDDOWN {intCORRERTODASPRUEBASSECOND-2}

\draw [->,bend left=15] (\ESCRIBIRRIGHT) to (\CORRERPRUEBAUP);
\draw [->,bend left=15] (node cs:name=correr_prueba, anchor=west) to  node [midway,left,pasastyle] { [pasa] } (node cs:name=escribir_prueba, anchor=south);
\draw [->,bend left=15] (\CORRERPRUEBADOWN) to node [midway,right,fallastyle] { [falla] } (\ESCRIBIRCODIGOUP);
\draw [->,bend left=15] (\ESCRIBIRCODIGODOWN) to (\CORRERTODASPRUEBASFIRSTRIGHT);
\draw [->,bend left=15] (node cs:name=correr_todas_pruebas_1, anchor=north) to  node [midway,left,fallastyle] { [falla] } (node cs:name=escribir_codigo, anchor=west);
\draw [->,bend left=15] (\CORRERTODASPRUEBASFIRSTLEFT) to node [midway,left,pasastyle] { [pasa] } (\REFACTORIZARDOWN);
\draw [->,bend left=15] (\REFACTORIZARUP) to (\CORRERTODASPRUEBASSECONDDOWN);
\draw [->,bend left=15] (node cs:name=correr_todas_pruebas_2, anchor=south) to  node [midway,right,fallastyle] { [falla] } (node cs:name=refactorizar, anchor=north);
\draw [->,bend left=15] (\CORRERTODASPRUEBASSECONDUP) to node [midway,left,pasastyle] { [pasa] }(\ESCRIBIRLEFT);

\draw [->,bend left=15] (node cs:name=start, anchor=east) to (node cs:name=escribir_prueba, anchor=north);
\end{tikzpicture}


I'm sure it's not the best way to do that, but as I said, I'm very new in tikz, and the concept seems clear: draw the nodes at 360/total_nodes degrees, find intersections between node and a circle, draw an arc between intersections.

So far so good. Now I want to do this, that is pretty much the same thing:

I would like to make the 3 bubbles (prueba-codigo-refactor) a node, so I can do the same thing I did before.

This code draws the 3 bubbles:

\begin{tikzpicture}
\node [draw, circle, fill=white, minimum width=5em]at (0, 0){Prueba};
\node [draw, circle, fill=white, minimum width=5em]at (1.2, -0.6){Código};
\node [draw, circle, fill=white, minimum width=5em]at (1.2, 0.6){Refactor};
\end{tikzpicture}


But I need the hole thing to behave as one node. So the questions are:

1. How can I do to make the 3 bubbles a node (and behave like a node) so I can do the same thing I did before?
2. This is all I can think with one-day experience with tikz, you sure know better and may come up with a better solution, I want to hear it!

I want to learn tikz, so a "here, paste this code and works, bye bye" it's not the best answer for me. On the other side, "look at this link, bye bye" it's kind of hard to me to understand, a MME would be awesome (and the link).

-
It’s rather complex to have one node (i.e. a shape) with three text parts, that behaves fully compatible, especially the shape border part. It may be easier to implement a macro that places three bubbles/nodes around mid point. –  Qrrbrbirlbel May 13 '13 at 13:28
In this case, the text in each bubble is always the same and it won't change, does that make any difference? Could you post the macro that does that? How do I do the intersections with that solution? –  Nico May 13 '13 at 13:30
The bit that I think will be really difficult is automatically computing intersection coordinates with the boundary since each of the three circles will have to be computed in turn and then some method used to figure out which intersection point is the right one. –  Loop Space May 13 '13 at 13:52
If this is what you can come up with after one day of TikZ, take a bow. Nice job so far. –  Matthew Leingang May 13 '13 at 15:27
@MatthewLeingang well, most of the job was done by guys here and pgf manual, it was a lot of copy-paste with little tweaks –  Nico May 13 '13 at 16:28

Since the node shape is not special in the sense that custom paths are not required, you can place two more nodes whenever you place one somewhere. I've cooked up a style that works for this example but you can also make it more customized to accept positioning details, colors, styles etc.

Some care is needed to use it as it is because it will draw over the bubbles if you address directly the underlying bubble for the paths. There are some remedies but I'm not sure if you need them. Also append after command should be used inside a path but here we are just being adventurous.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{single bubble/.style={draw, circle, fill=white, minimum width=5em},
tribubble/.style={
single bubble,
append after command={
\pgfextra{\let\mylastnode\tikzlastnode}
node [single bubble, above right = 1mm and 5mm of \mylastnode.center] {Código}
node [single bubble, below right = 1mm and 5mm of \mylastnode.center] {Refactor}
}
}
}

\begin{document}

\begin{tikzpicture}
\draw (0,0) circle (3cm);
\node[tribubble] at (45:3cm){Prueba};
\node[tribubble] at (-45:3cm){Prueba};
\end{tikzpicture}

\end{document}


-
@Qrrbrbirlbel Where is the fun in that? :P –  percusse May 13 '13 at 22:15
Even less adventure (this produces the same layout as OP’s): label={[single bubble, shift={(1.2,-0.6)}]center:Código},label={[single bubble, shift={(1.2,0.6)}]center:Refactor}. –  Qrrbrbirlbel May 13 '13 at 22:24
Oh, I like it. I'll see what I can do with the intersection and I'd let you know. Thks! –  Nico May 13 '13 at 23:45
@Qrrbrbirlbel I don't understand how to use what you said, could you give me some tips? –  Nico May 14 '13 at 1:02
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7235736846923828, "perplexity": 5547.751955306102}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-52/segments/1418802775656.66/warc/CC-MAIN-20141217075255-00089-ip-10-231-17-201.ec2.internal.warc.gz"}