4 tikzpictures en un diseño de 2x2

4 tikzpictures en un diseño de 2x2
 \documentclass{article}
 \usepackage{pgfplots}
 \usetikzlibrary{fit,shapes,positioning}

 \begin{document}

 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}
\end{document}

El MWE anterior genera un diagrama de mapeo. Estoy intentando crear un 2x2 groupplotdel diagrama de mapeo de funciones anterior.

He utilizado el groupplotentorno en ocasiones anteriores con gran éxito (al utilizar gráficas en un plano cartesiano); a través del \addplotcomando.

Sin embargo, usando el TikComandos Z para los diagramas de mapeo de funciones, todo lo que puedo generar son 4 casillas con marcas alrededor.

Respuesta1

Personalmente, me gusta usar el paquete subfig dentro de una figura.

\documentclass{article}
 \usepackage{pgfplots}
 \usetikzlibrary{fit,shapes,positioning}
\usepackage{here}
\usepackage{subfig}

 \begin{document}

\begin{figure}[H]
\centering
\subfloat{
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}}
\subfloat{
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}}

\subfloat{
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}}
\subfloat{
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}}


\end{figure}


\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

A tikzpicturees como a char, puedes organizarlos como quieras. En este caso particular, he usado a tabularpara colocarlos 2x2.

\documentclass{article}
 \usepackage{pgfplots}
 \usetikzlibrary{fit,shapes,positioning}

\begin{document}

\begin{tabular}{cc}
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}
&
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}
\\
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}
&
 \begin{tikzpicture}[
  mydot/.style={   circle,   fill,   inner sep=2pt }, >=latex,
                shorten >= 3pt, shorten <= 3pt,
  every fit/.style={ellipse,draw,inner sep=0pt}
 ]


 \node[mydot,label={left:1}] (a1) {};  
 \node[mydot,below=of a1,label={left:2}] (a2) {};  
 \node[mydot,below=of a2,label={left:3}] (a3) {};  
 \node[mydot,below=of a3,label={left:4}] (a4) {}; 

 \node[mydot,right=4cm of a1,label={right:1}] (b1) {};  
 \node[mydot,below=of b1,label={right:2}] (b2) {};  
 \node[mydot,below=of b2,label={right:3}] (b3) {};  
 \node[mydot,below=of b3,label={right:4}] (b4) {};

 \node[draw,fit=(a1) (a2) (a3) (a4),minimum width=2cm] {} ;
 \node[draw,fit=(b1) (b2) (b3) (b4),minimum width=2cm] {} ;

 \path[->] (a1) edge (b2) edge (b1); 
 \path[->] (a2) edge (b4); 
 \path[->] (a3) edge (b3); 
 \path[<-] (a4) edge (b1);

\end{tikzpicture}
\end{tabular}
\end{document}

ingrese la descripción de la imagen aquí

información relacionada