I'm pretty new to Tikz. How can I draw the below graph in Tikz?system

I will break up my questions into small pieces.

  1. How can I group a bunch of objects and form a big one?
  2. How can I zoom an object and place detailed objects into the zoomed container?
  3. How to draw a human figure?
  4. How to scatter objects inside a container without predefined placement info?

Any help is much appreciated!

  • 3
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Mar 16 '17 at 10:07
  • Not sure if it applies here, but, perhaps tikz-UML package can be useful. – JLDiaz Mar 16 '17 at 10:16
  • See also tex.stackexchange.com/questions/84420/… – John Kormylo Mar 16 '17 at 21:41

This is too complicated for a comment. It is based on Gregor Perčič's solution.

First, you can simplify drawing rectangles. Second, using a scope you can move a group of objects around using the shift key, and create a node (more or less) using the local bounding box key.



\begin{scope}[shift={(1,1)},local bounding box=A]
\draw (0,0) rectangle (11.3,1.5);
\draw (0.2,0.2) rectangle (3.2,1);
\draw (3.7,0.2) rectangle (6.7,1);
\draw (7.2,0.2) rectangle (10.2,1);
\node[scale=0.8] at (1.65,0.5) {$S_{x_{1}}$};
\node[scale=0.8] at (5.5,0.5) {$S_{x_{2}}$};
\node[scale=0.8] at (8.5,0.5) {$S_{x_{3}}$};
\node[scale=0.8] at (10.65,0.5) {$S_{x}$};

\draw[->] (0,0) -- (A.west);
| improve this answer | |
  • Ah, this is nice. Can I add some randomization to inner rectangles placement? – Amos Mar 16 '17 at 16:44
  • I'm actually somewhat ashamed that I couldn't find a better way to construct the diagram. I've been using Tikz for a long time, but for this example, it seems to me, there isn't any witty solution. John, can you perhaps help me improve my Tikz skills? I'd be grateful. – Gregor Perčič Mar 16 '17 at 17:05
  • @GregorPerčič - It is not unusual to ask questions here about better ways of doing things. That is how I learned a lot of useful tricks. – John Kormylo Mar 16 '17 at 21:37

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.