2

This is a follow-up question to Figure with table (using tikz with library matrix).

Although I received a great answer and good feedbacks for my previous question (see above link), I am having a hard time making some changes to it; such as removing one row and one column in the figure while adjusting the position of labels and the external texts (with the brackets).

After trying several times, I decided to ask for help here.

I'm looking for this:
Goal

My code is below [with the last lines of the code commented, because that's the part I am not getting right]:

    \documentclass[12pt,a4paper]{article}
    \usepackage[margin=1in]{geometry} 
    \usepackage{makecell}
    \usepackage{tikz} 
    \usetikzlibrary{trees, 
            calc, 
            matrix, 
            decorations.pathreplacing,
            calligraphy,
            positioning} 


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \begin{document} 

    \begin{figure}[htbp!]
    \centering
    \footnotesize
    \caption{Levels of Policy Monitoring}
    \label{monitoring}
    \begin{tikzpicture}[
    node distance = 1mm and 3mm,
    BC/.style = {decorate,
    decoration={calligraphic brace, amplitude=3mm,
    raise=#1, mirror}, thick, pen colour={gray}},
                ]
    \matrix (m) [matrix of nodes,
         nodes={draw, minimum size=25mm, outer sep=0pt},
         column sep=-\pgflinewidth,
         row sep=-\pgflinewidth,
         colum 1/.style={font=\bfseries},
         row 1/.style={font=\bfseries},
         CB/.style = {fill=black!80, text=white},
         CG/.style = {fill=gray},
         CS/.style = {fill=gray!50}, 
         ]
    {       & {\makecell{President's \\ Party}}   & {\makecell{Party A}} \\
    {\textbf{\makecell{President's \\ Party}}}   & |[CS]| {\makecell{Within \\ Cabinet \\ Party}}   &  {\makecell{Among \\ Cabinet \\ Parties}}  \\
    { \textbf{\makecell{Party A}}}   &  {\makecell{Among \\ Cabinet \\ Parties}}   & |[CS]| {\makecell{Within \\ Cabinet \\ Party}}   \\
    {\textbf{\makecell{Party C}}}    &  {\makecell{From \\ Opposition \\ Party}}      &  {\makecell{From \\ Opposition \\ Party}}   \\
    };
    %\node[above=of m-1-3] {\textbf{Answering}};
    %\node[left =of m-3-1, rotate=90] {\textbf{Questioning}};
    %\draw[BC= 2mm, rotate=180] (m-4-4.south east) -- node[below= -10mm, sloped] {Cabinet Members} (m-1-4.north east);
    %\draw[BC=11mm, rotate=180] (m-5-4.south east) -- node[below=-19mm, sloped] {Legislative Parties} (m-1-4.north east);
    \end{tikzpicture}
    \end{figure}

    \end{document}
2

enter image description here

your code has many errors: (i) you left out fix for calligraphy library and (ii) due to unnecessary complications with nodes with multi line contents ... for this you not need \makecell macro, just define text width of nodes:

\documentclass[12pt,a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
% temporary fix for calligraphy package <---
\usepackage{expl3}
\ExplSyntaxOn
\int_zero_new:N \g__prg_map_int
\ExplSyntaxOff
% end of temporary fix
\usetikzlibrary{calc,
                matrix,
                decorations.pathreplacing,
                calligraphy,
                positioning,
                trees}

\begin{document}
    \begin{figure}[htbp!]
\centering
\footnotesize
\caption{Levels of Policy Monitoring}
\label{monitoring}
\begin{tikzpicture}[
node distance = 1mm and 3mm,
    BC/.style = {decorate,
decoration={calligraphic brace, amplitude=3mm, raise=#1}, 
very thick, pen colour={gray}},
    BF/.style = {font=\bfseries},   % <---
    CB/.style = {fill=black!70, text=white},
    CG/.style = {fill=gray},
    CS/.style = {fill=gray!50},
            ]
\matrix (m) [matrix of nodes, 
     nodes={draw, minimum size=24mm, align=flush center, % <---
            text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep}, % <---
            outer sep=0pt, anchor=south},
     column sep=-\pgflinewidth,
     row sep=-\pgflinewidth,
     colum 1/.style={font=\bfseries},
     row 1/.style={font=\bfseries},
     ]
{       & President's Party             & Party A                       \\
|[BF]| President's Party 
        & |[CS]| Within Cabinet Party   &  Among Cabinet Parties        \\
|[BF]| Party A
        &  Among Cabinet Parties        & |[CS]| Within Cabinet Party   \\
|[BF]| Party C
        &  |[CB]| From Opposition Party & |[CB]| From Opposition Party  \\
};
\node[BF, above=of m-1-2.north east] {Answering};
\node[BF, left =of m-3-1, rotate=90,anchor=south] {Questioning};
\draw[BC= 2mm] (m-1-3.north east) -- node[above= 5mm, sloped] {Cabinet Members} (m-3-3.south east);
\draw[BC=12mm] (m-1-3.north east) -- node[above=15mm, sloped] {Legislative Parties} (m-4-3.south east);
\end{tikzpicture}
    \end{figure}
\end{document}

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.