Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have been looking into TikZ figures and can somewhat adapt them. To create one that has the capabilities that I would like is another matter.

For my thesis I am looking to create this figureCompany overview

I know it is a simple one but I am struggling with the alignment

So i have been fiddling a bit the result is not bad, but id like to line out the green boxes

This is my MWE:

    \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, calc, shapes, arrows}
\renewcommand{\figurename}{Figure}

\begin{document}

\begin{figure}[!htb]
    \centering
    \begin{tikzpicture} [
        title/.style={font=\fontsize{18}{18}\color{black!45}},
        capt/.style={font=\fontsize{18}{18}\color{black!45},node distance=10em,anchor=west},
        firm/.style={rectangle, draw, fill=blue!23, rounded corners, minimum width=6em,fill opacity=0.5},
        industry/.style={rectangle, draw, fill=green!23, rounded corners, minimum width=25em,fill opacity=0.3},
        region/.style={rectangle, draw, fill=red!23, rounded corners, minimum height=2em,fill opacity=0.3},
        ]
        % Place nodes
        \node (dummy) {};
        \node [title] (in)[right=2cm of dummy] {India};
        \node [title] [below=5mm of in] (infy) {Infosys};

        \node [title] (wp) [below=1.5cm of in]  {WiPro};
        \node [firm] (InIt) [draw=black!50, fit= (infy) (wp)] {};



        \node [title] (eur) [right=2cm of in] {Europa};        
        \node [title] (cap) [below=5mm of eur] {Cap};
        \node [title] (Ts)  [below=1.5cm of eur] {Tsystems};
        \node [firm] (EuIt) [draw=black!50, fit= (cap) (Ts)] {};



        \node [capt] (its) [below=1.25cm of dummy] {IT Services};
        \node [capt] (ph) [below=3.5cm of dummy] {Pharmaceutical};

        \node [industry][draw=black!50, fit=(its)(InIt)(EuIt)]{}; 
        \node [title] (ran) [below=3cm of in]  {Ranbaxy};
        \node [title] (cip) [below=4cm of in]  {Cipla};
        %\node [draw=black!50, fit=(ph)(wp)(cap)]{}; 

        \node [title] (nov) [below=3cm of eur]  {Novartis};
        \node [title] (gsk) [below=4cm of eur]  {GSK};
        \node [firm] (EuPh) [draw=black!50, fit= (nov) (gsk)]  {};
        \node [firm] (InPh) [draw=black!50, fit= (ran) (cip)]  {};

        \node [region] [draw=black!50, fit=(eur)(EuPh)]{}; 
        \node [region] [draw=black!50, fit=(in)(InPh)]{}; 
        \node [industry] [draw=black!50, fit=(ph)(InPh)(EuPh)]{}; 

    \end{tikzpicture}
    \caption{Clients graph}
\end{figure}

\end{document}
share|improve this question
2  
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. Let me know when you edited your question and I’ll redeem my downvote ;-) –  Tobi Dec 5 '13 at 17:40
2  
I would define four nodes for the texts "Nov/GSK", "CIP/RAN", etc and use fit library to draw another nodes which encloses those, first horizontally, then vertically, and use label attributes for the enclosing ones to put the EU, IN, Pharma, and ITS labels. –  JLDiaz Dec 5 '13 at 17:48
    
@Tobi, I have provided the MWE. Thanks for responding –  wierts Dec 5 '13 at 19:13
    
@wierts: Your code looks good, what is it that you're trying to add to the figure? Just the four boxes? –  Kevin C Dec 5 '13 at 19:23
1  
+1 now :-) Just a note: I use \tikzset in the preamble for global settings and for local settings the optional argument of {tikzpicture} –  Tobi Dec 5 '13 at 21:09

1 Answer 1

up vote 6 down vote accepted

I would use \matrix to position the Firm nodes, and manually draw the boxes. (Somehow the fit library doesn't work, and so the boxes are not drawn with the most elegant code :().

Code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,decorations,arrows,positioning,matrix,calc} 
\usepackage{verbatim}


\begin{document}

\pagestyle{empty}

\begin{tikzpicture}[scale=2]

\tikzset{
    mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=yellow!50,very thick, inner sep=1em, minimum size=3em, text centered},
    myarrow/.style={->, >=latex', shorten >=1pt, thick},
    mylabel/.style={text width=7em, text centered}, 
    myFirm/.style={rectangle,rounded corners,draw=black, thin, inner sep=1em, minimum size=3em, text centered}
}  

\matrix(m)[matrix of nodes,
  nodes={myFirm},
  row sep=5ex,
  column sep=10ex,
]{
  Novatis GSK & Cipla Ranbaxy \\
  Cap T-sys & Infy WP \\
};

\pgfmathsetlengthmacro\thinpad{3pt}
\pgfmathsetlengthmacro\thickpad{6pt}
\draw let \p{11nw}=(m-1-1.north west), \p{11se}=(m-1-1.south east), 
          \p{21nw}=(m-2-1.north west), \p{21se}=(m-2-1.south east),
          \p{12nw}=(m-1-2.north west), \p{12se}=(m-1-2.south east),
          \p{22se}=(m-2-2.south east) in
  ($(\x{11nw},\y{11nw})+(-\thinpad,\thickpad)$)rectangle($(\x{11se},\y{21se})+(\thinpad,-\thickpad)$)
  ($(\x{12nw},\y{12nw})+(-\thinpad,\thickpad)$)rectangle($(\x{12se},\y{22se})+(\thinpad,-\thickpad)$)
  ($(\x{11nw},\y{11nw})+(-\thickpad,\thinpad)$)rectangle($(\x{12se},\y{12se})+(\thickpad,-\thinpad)$)
  ($(\x{11nw},\y{21nw})+(-\thickpad,\thinpad)$)rectangle($(\x{12se},\y{22se})+(\thickpad,-\thinpad)$)
;

\node[mynode,above=of m-1-1]{Europe};
\node[mynode,above=of m-1-2]{India};
\node[mynode,left =2.5 of m-1-1.center](Ph){Pharma};
\node[mynode,left =2.5 of m-2-1.center]{ITS};

\end{tikzpicture}

\end{document}

Output

enter image description here


Update

In response to the update of OP.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, calc, shapes, arrows,backgrounds}

\renewcommand{\figurename}{Figure}

\begin{document}

\begin{figure}[!htb]
  \centering
  \begin{tikzpicture} [
      title/.style={font=\fontsize{18}{18}\color{black!45},align=center,on grid},
      capt/.style={font=\fontsize{18}{18}\color{black!45},node distance=10em,anchor=west},
      firm/.style={rectangle, draw, fill=blue!23, rounded corners, minimum width=6em,minimum height=3em,fill opacity=0.5},
      industry/.style={rectangle, draw, fill=green!23, rounded corners, minimum width=9cm,minimum height=1.5cm,on grid,fill opacity=0.3},
      region/.style={rectangle, draw, fill=red!23, rounded corners, minimum height=2em,fill opacity=0.3},
    ]
    % industry and region boxes
    \node(IT)[industry]{};
    \node(Ph)[industry,below=2cm of IT]{};

    % place coordinates for later use
    \coordinate(r1c1)at($(IT.west)!.2!(IT.east)$);
    \coordinate(r1c2)at($(IT.west)!.5!(IT.east)$);
    \coordinate(r1c3)at($(IT.west)!.85!(IT.east)$);
    \coordinate(r2c1)at($(Ph.west)!.2!(Ph.east)$);
    \coordinate(r2c2)at($(Ph.west)!.5!(Ph.east)$);
    \coordinate(r2c3)at($(Ph.west)!.85!(Ph.east)$);

    % firm boxes
    \node(f1)[firm] at(r1c2){};
    \node(f2)[firm] at(r2c2){};
    \node(f3)[firm] at(r1c3){};
    \node(f4)[firm] at(r2c3){};

    % Place nodes
    \node[title] at (r1c1){IT Services};
    \node[title] at (r2c1){Pharmaceutical};

    \node[title] at (r1c2){Infosys \\ WiPro};
    \node[title] at (r2c2){Ranbaxy \\ Cipla};

    \node[title] at (r1c3){Cap \\ Tsystems};
    \node[title] at (r2c3){Novartis \\ GSK};

    \node(IND)[title,yshift=1.2cm] at (r1c2) {India};
    \node(EUR)[title,yshift=1.2cm] at (r1c3) {Europe};

    % region boxes
    \begin{scope}[on background layer]
      \node[region,fit=(IND) (f2)]{};
      \node[region,fit=(EUR) (f4)]{};
    \end{scope}
  \end{tikzpicture}
  \caption{Clients graph}
\end{figure}

\end{document}

Output

enter image description here

share|improve this answer
    
This is quite brilliant, One more question: Is is possible to have the names of the firms BELOW (and with bullets) each other. I had them side by side cos i do not know how to do this? –  wierts Dec 5 '13 at 21:13
    
@wierts: you mean like an itemize environment? –  Kevin C Dec 5 '13 at 21:51
    
Exactly that is what i would like –  wierts Dec 5 '13 at 22:04
    
I got the fit to work. See my MWE now i just have to line out the boxes and I am golden –  wierts Dec 5 '13 at 23:15
    
@wierts: I've updated my answer. You can play with the width and height parameters to get the right sizes of boxes. I hope this is what you're looking for. –  Kevin C Dec 6 '13 at 2:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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