2

I am trying to draw arrows next to a table like this:

table

I was able to draw vertical arrows using the technique shown here:

$\left.
  \begin{tabular}{|c|c|c|}
    \hline medium & high & high \\
    \hline low & medium & high \\
    \hline low & low & medium \\
    \hline
  \end{tabular}
\right\uparrow
\rotatebox[origin=c]{90}{Impact}$

table latex

However I have no idea how to draw the horizontal arrow on top of the table. This answer seems to use the same technique to draw horizontal arrows but I was unable to adapt it. It should also be possible to use TikZ but I would like to keep it simple.

2

3 Answers 3

4

It's been a while since you asked for this but I just stumbled on it.
Since you asked for a tikz solution, here's a simple one.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\begin{document}

\def\spc{7pt} % Space between array and arrows, adjuts the arrows length automatically

\tikzset{myarrow/.style={-stealth,shorten >=\spc, shorten <=\spc}}

\begin{tikzpicture}
    
    \node[inner sep=\spc] (t)
        {
        \begin{tabular}{|*{3}{c|}}
        \hline medium & high & high \\
        \hline low & medium & high \\
        \hline low & low & medium \\
        \hline
        \end{tabular}
        };
    
    \draw[myarrow] (t.north west) -- (t.north east) node[midway,above] {Likelihood};
    \draw[myarrow] (t.south east) -- (t.north east) node[midway,below,sloped] {Impact};
\end{tikzpicture}

\end{document}

Arrows around array

1
  • This solution is clean and simple. Thanks.
    – DurandA
    Jan 13, 2021 at 17:30
4

Just with xrightarrow:

\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{bigstrut}
\usepackage{array, rotating, cellspace}
\setlength{\cellspacetoplimit}{6pt}
\setlength{\cellspacebottomlimit}{6pt}

\begin{document}

$\xrightarrow[%
  \left.\begin{tabular}{|*{3}{>{\sffamily}Sc|}}
    \hline medium & high & high \\
    \hline low & medium & high \\
    \hline low & low & medium \\
    \hline
  \end{tabular}%
  \enspace \right\uparrow\hskip-1em\rlap{\hskip 1.25em\rotatebox[origin=c]{90}{\sffamily Impact}}]
{\textsf{\normalsize Likelihood}\bigstrut} $

\end{document} 

enter image description here

1

Here is a solution with {NiceTabular} of nicematrix and Tikz.

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}
\begin{NiceTabular}{ccc}[hvlines,first-row,last-col,cell-space-limits=6pt]
\Cdots[line-style={solid,->}]^{\text{Likelihood}} \\
medium & high & high 
& \Vdots[line-style={xshift=3mm,solid,<-}]^{\text{Impact}} \\
low & medium & high \\
low & low & medium \\
\end{NiceTabular}
\end{document} 

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Output of the above code

You must log in to answer this question.

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