2

I have an existing graph with some nodes and edges, written with TikZ/pgf, and I need to add a couple of plates to them to make it a hierarchical model (similar to those in http://en.wikipedia.org/wiki/Hierarchical_Bayes_model).

I can hard-code the position and size of the rectangles, but I am wondering if there are ways to do this automatically? i.e. can I specify the nodes and circle-less text nodes that the rectangles need to bound to, and have the rectangles expand when they get bigger?

1
  • 4
    Why don't you just present what you have done so far? Others a rarely motivated to reproduce that from scratch just for testing possible solutions. Commented Feb 22, 2011 at 19:09

1 Answer 1

4

You can draw such rectangles around nodes using the fit TikZ library. See the pgfmanual section 24 for a detailed description.

For a rectangle around a circle node which some space on the left side, like in your linked example, you can use the calc library:

\usetikzlibrary{fit}
\usetikzlibrary{calc}
% ...
\node [draw,circle] (A) {Text};
\node [draw,fit=(A) ($A.west - 3cm$)] {};
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .