1

Figure 1

Can I make the figure which I just posted here in LaTeX?

3
7

Making use of Claudio Fiandrino's suggestion to use a matrix to typeset the diagrams as well as the subcaption package and some minipages, here's a way to implement the figure that you have in mind. Note the required %s in order to make sure that the first two minipages appear next to each other rather than on top of each other.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{subcaption}

\begin{document}

\begin{figure}
\centering

    \begin{minipage}[b]{.4\linewidth}
    \centering

        \begin{tikzpicture}

        \matrix[name=M, matrix of nodes, column sep=1cm, row sep=1cm]{
            \node[draw,minimum size=1cm]{IQ}; & \node[draw,minimum size=1cm]{Z}; \\
            \node[draw,minimum size=1cm]{JP}; & \node[draw,minimum size=1cm]{R}; \\
        };

        \draw[<->] (M-1-2) edge (M-2-2);
        \draw[<->] (M-1-1) edge (M-2-1);    
        \draw[<->] (M-1-1) edge (M-2-2);
        \draw[<->] (M-2-1) edge (M-2-2);

    \end{tikzpicture}

    \subcaption{MNAR Mechanism}\label{fig:1a}
    \end{minipage}%
%
    \begin{minipage}[b]{.4\linewidth}
    \centering

        \begin{tikzpicture}

            \matrix[name=M, matrix of nodes, column sep=1cm, row sep=1cm]{
                \node[draw,minimum size=1cm]{IQ}; & \node[draw,minimum size=1cm]{Z}; \\
                \node[draw,minimum size=1cm]{JP}; & \node[draw,minimum size=1cm]{R}; \\
            };

            \draw[<->] (M-1-2) edge (M-2-2);
            \draw[<->] (M-1-1) edge (M-2-1);    
            \draw[<->] (M-1-1) edge (M-2-2);

        \end{tikzpicture}

    \subcaption{MAR Mechanism}\label{fig:1b}
    \end{minipage}

    \begin{minipage}[b]{.4\linewidth}
    \centering

        \begin{tikzpicture}

            \matrix[name=M, matrix of nodes, column sep=1cm, row sep=1cm]{
                \node[draw,minimum size=1cm]{IQ}; & \node[draw,minimum size=1cm]{Z}; \\
                \node[draw,minimum size=1cm]{JP}; & \node[draw,minimum size=1cm]{R}; \\
            };

            \draw[<->] (M-1-2) edge (M-2-2);
            \draw[<->] (M-1-1) edge (M-2-1);

        \end{tikzpicture}

    \subcaption{MCAR Mechanism}\label{fig:1b}
    \end{minipage}

    \caption{Figures}\label{fig:1}

\end{figure}

\end{document}

enter image description here

2
  • It is suggestive to use the subfigure environment with a usual \caption command instead of a minipage with \subcaption. As alternative there is the \subcaptionbox command. Oct 7 '13 at 19:49
  • Excellent job.. Thanks it works exactly the same way I wanted it
    – user35571
    Oct 8 '13 at 2:27
1

Here is some code that puts in an approximation of the upper left diagram. By playing with the parameters you can get a better approximation. Enlarge the boxes containing the characters and shrink slightly the boxes containing the frameboxes:

 \documentclass{article}
 \usepackage[barr,pdf]{xy}

\begin{document}
$$\bfig
 \node 1a(0,0)[\framebox{IQ}]
 \node 1b(400,0)[\framebox{Z}]
 \node 2a(0,-400)[\framebox{JP}]
 \node 2b(400,-400)[\framebox{R}]
 \arrow/<->/[1a`1b;]
 \arrow/<->/[1a`2a;]
 \arrow/<->/[1a`2b;]
 \arrow/<->/[2a`2b;]
 \arrow/<->/[1b`2b;]
 \efig$$
\end{document}
2
  • Please, don't use $$ in LaTeX documents (at least not those you present here).
    – egreg
    Oct 7 '13 at 21:06
  • What does option barr to package xy do? I couldn't find it documented.
    – murray
    Aug 12 '17 at 14:39
1

after almost four years ... with use of subfigure environments and recent version of tikz:

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, matrix}
\usepackage{subcaption}

\usepackage[active,floats,tightpage]{preview}% only for figure test
    \setlength\PreviewBorder{1em}

\begin{document}
    \begin{figure}
    \tikzset{
            > = Stealth,
Matrix/.style = {matrix of nodes,
                 nodes={draw, minimum size=10mm},
                 column sep=1cm, row sep=1cm}
            }
\centering
    \begin{subfigure}[t]{0.32\linewidth}
    \centering
\begin{tikzpicture}
\matrix (m) [Matrix]
{
IQ  &   Z   \\
JP  &   R   \\
};
\draw[<->]  (m-1-2) edge (m-2-2)
            (m-1-1) edge (m-2-1)
            (m-1-1) edge (m-2-2)
            (m-2-1) edge (m-2-2);
\end{tikzpicture}
\caption{MNAR Mechanism}
    \label{fig:1a}
\end{subfigure}
\hfil
\begin{subfigure}[t]{0.32\linewidth}
    \centering
\begin{tikzpicture}
\matrix (m) [Matrix]
{
IQ  &   Z   \\
JP  &   R   \\
};
\draw[<->]  (m-1-2) edge (m-2-2)
            (m-1-1) edge (m-2-1)
            (m-1-1) edge (m-2-2);
\end{tikzpicture}
\caption{NAR Mechanism}
    \label{fig:1b}
\end{subfigure}
\hfil
\begin{subfigure}[t]{0.32\linewidth}
    \centering
\begin{tikzpicture}
\matrix (m) [Matrix]
{
IQ  &   Z   \\
JP  &   R   \\
};
\draw[<->]  (m-1-2) edge (m-2-2)
            (m-1-1) edge (m-2-1);
\end{tikzpicture}
\caption{MCAR Mechanism}
    \label{fig:1c}
\end{subfigure}
    \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.