2

I created following figure with a script as pasted below:

Shot

\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.multipart, arrows, shadows, backgrounds, fit}

\tikzset{
  bluebox/.style={
    draw,
    rectangle,
    minimum height=4.5cm,
    fill=blue!50!white,
    align=center,
    inner sep=2ex
  },
  whitebox/.style={
    draw,
    rectangle,
    minimum height=4.5cm,
    fill=white,
    align=center,
    inner sep=2ex
  },
  item/.style={
    draw,
    inner sep=1ex,
    fill=white 
  },
  matrix/.style={
    draw,
    fill=white,
    text centered,
    minimum height=1em,
    drop shadow
  }
}

\begin{document}

\begin{tikzpicture}[font=\sffamily]

    % Stage 1
    \node[whitebox, label={Labela}] (Stage1) {\rotatebox{90}{Something}};

    % Stage 2
    \node[whitebox, right=of Stage1, label=Labelpgq] (Stage2) {\rotatebox{90}{\footnotesize{Something}}};

    % Stage 3
    \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, right=of Stage2, label=Options A] (OptionsA) {
        \nodepart{one} A
        \nodepart{two} B};

    \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, below=of OptionsA, label=Options B] (OptionsB) {
        \nodepart{one} A
        \nodepart{two} B};

    \begin{scope}[on background layer]
        \node[bluebox, fit=(OptionsA) (OptionsB), label=Labelg] (Stage3) {};
    \end{scope}

    \draw[dashed] (Stage1) -- (Stage2);
    \draw[dashed] (Stage2) -- (Stage3);
\end{tikzpicture}

\end{document}

Here are the issues I want to solve:

  1. When labels contain a "p", "g" or "q", the text has a larger distance. It looks like the padding is given by the lowest pixel (bug?).
  2. For some reason, the blue box is shifted. It should be on level with the others. I experimented by applying "right=of Stage2" to the blue box, but without success.

I'm thankful for help here.

  • 1
    You could use \strut to fix the alignment of the two labels: label={\strut Labela} and label={\strut Labelpgq} – luki Jan 10 '18 at 14:16
  • Thank you, it appears that one worked. Now is only the box alignment thing open. – Johnny Joe Jan 10 '18 at 15:55
  • right=of <blah> uses the default anchor i.e. centre. Try right=of Stage2.north, anchor=north, say. I would recommend drawing the inner boxes in the blue box first, then the blue box around them, then the boxes to the left. This will be less fiddly than trying to place the inner boxes relative to the large ones. (And split nodes are always problematic, so easier deal with those first.) – cfr Jan 10 '18 at 17:43
1

Draw inner boxes of blue box first, then the bluebox on background and finally Stage 2 and Stage 1 boxes on the left side of the blue box.

I've also added a name to one of options boxes label. This way it can be included in fit list for bluebox and size of labels is considered for bluebox size.

\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.multipart, arrows, shadows, backgrounds, fit}

\tikzset{
  bluebox/.style={
    draw,
    rectangle,
    minimum height=4.5cm,
    fill=blue!50!white,
    align=center,
    inner sep=2ex
  },
  whitebox/.style={
    draw,
    rectangle,
    minimum height=4.5cm,
    fill=white,
    align=center,
    inner sep=2ex
  },
  item/.style={
    draw,
    inner sep=1ex,
    fill=white 
  },
  matrix/.style={
    draw,
    fill=white,
    text centered,
    minimum height=1em,
    drop shadow
  }
}

\begin{document}

\begin{tikzpicture}[font=\sffamily]

    % Stage 3
    \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, label=Options A] (OptionsA) {
        \nodepart{one} A
        \nodepart{two} B};

    \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, below=of OptionsA, label={[name=opB]Options B}] (OptionsB) {
        \nodepart{one} A
        \nodepart{two} B};

    \begin{scope}[on background layer]
        \node[bluebox, fit=(opB) (OptionsA) (OptionsB), label=Labelg\strut, inner xsep=1ex] (Stage3) {};
    \end{scope}

    % Stage 2
    \node[whitebox, left=of Stage3, label=Label\strut] (Stage2) {\rotatebox{90}{\footnotesize{Something}}};

    % Stage 1
    \node[whitebox, left=of Stage2, label={Label a\strut}] (Stage1) {\rotatebox{90}{Something}};

    \draw[dashed] (Stage1) -- (Stage2);
    \draw[dashed] (Stage2) -- (Stage3);
\end{tikzpicture}

\end{document}

enter image description here

| improve this answer | |
0

it seems that OP has two accounts and with them ask the same question .. on other i provide the the following solution:

code below draw image from right to left. the height of the white boxes is determined by measurement of the blue box:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, fit, positioning, shapes.multipart}

\tikzset{
     base/.style = {rectangle, draw, align=center,
                   inner xsep=0ex, inner ysep=1ex},
  bluebox/.style = {base, fill=blue!50!white},
 whitebox/.style = {base, fill=white, inner sep=1ex},
    ABbox/.style = {rectangle split, rectangle split parts=2, draw, fill=white},
 every label/.append style = {text depth=0.5ex}
        }

\begin{document}
    \begin{tikzpicture}[font=\sffamily]
% Box 1
    \node[ABbox, label={[name=A]Options A}] (OptionsA) {
        \nodepart{one} A
        \nodepart{two} B};
    \node[ABbox, below=of OptionsA, label=Options B] (OptionsB) {
        \nodepart{one} A
        \nodepart{two} B};
    \scoped[on background layer]
        \node[bluebox, fit=(A) (OptionsB), label={Labelg}] (Box1) {};
\path   let \p1 = ($(Box1.north)-(Box1.south)$),
            \n1 = {veclen(\y1,\x1)} in
% Box 2
        node[whitebox, minimum height=\n1,
             label=Label 1, 
             left=of Box1] (Box2) {\rotatebox{90}{\footnotesize{Something}}}
% Box 3
        node[whitebox, minimum height=\n1,
             label=Label pgq,
             left=of Box2] (Box3) {\rotatebox{90}{\footnotesize{Something}}}
             ;
    \draw[dashed]   (Box1) -- (Box2)
                    (Box2) -- (Box3);
    \end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |

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.