Saltar al contenido

cuadrícula tikz de parcelas

Después de tanto luchar ya dimos con la respuesta de este asunto que algunos de nuestros lectores de este sitio presentan. Si deseas compartir algún detalle no dudes en compartir tu conocimiento.

Solución:

Sin subtítulos:

documentclassarticle
usepackagetikz
usetikzlibraryautomata, backgrounds,calc,shapes

begindocument
    beginfigure[ht]
    centering
tikzsetshorten >=1pt,
        node distance=1cm,
        font = tiny,
        auto,%on grid
        state/.style = shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt
        
begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state,  very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;
endtikzpicture
hfil
begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a11) edge node (a12)
    (a11) edge node (a21);
endtikzpicture

vspace11mm
begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a12) edge node (a22)
    (a21) edge node (a31);
endtikzpicture
hfil
begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a12) edge node (a22)
    (a31) edge node (a32);
endtikzpicture
endfigure
enddocument

ingrese la descripción de la imagen aquí

Con subtítulos y subtítulos:

documentclassarticle
usepackagetikz
usetikzlibraryautomata, backgrounds,calc,shapes
usepackagesubfig

begindocument
    beginfigure[ht]
    centering
tikzsetshorten >=1pt,
        node distance=1cm,
        font = tiny,
        auto,%on grid
        state/.style = shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt
        
subfloat[]begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state,  very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;
endtikzpicture
hfil
subfloat[]begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a11) edge node (a12)
    (a11) edge node (a21);
endtikzpicture

vspace11mm
subfloat[]begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a12) edge node (a22)
    (a21) edge node (a31);
endtikzpicture
hfil
subfloat[]begintikzpicture
    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state, very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;

    path[->,draw,thick]
    (a12) edge node (a22)
    (a31) edge node (a32);
endtikzpicture
    captionmy 2 x 2 images
    labelfig:fourimages
endfigure
enddocument

ingrese la descripción de la imagen aquí

Sin relación:
El código para sus imágenes se puede acortar significativamente si emplea la biblioteca TikZ matrix. Por ejemplo, el segundo ejemplo anterior se puede escribir como:

documentclassarticle
usepackagetikz
usetikzlibrarymatrix

usepackagesubfig

begindocument
    beginfigure[ht]
    centering
tikzsetM/.style = matrix of math nodes,
                     ampersand replacement=&,
                     column sep = 9mm,
                     row sep = 9mm,
                     nodes = circle, draw, thick, minimum size=+3ex,
                              font=tiny, anchor=center,
                     ,  
every edge/.style =  draw, ->, thick
        
subfloat[]
begintikzpicture
matrix (m1) [M]

    a_31  &  a_32  \
    a_21  &  a_22  \
    a_21  &  a_22  \
;
endtikzpicture
hfil
subfloat[]
begintikzpicture
matrix (m2) [M]

    a_31  &  a_32  \
    a_21  &  a_22  \
    a_21  &  a_22  \
;
%
path   (m2-1-1) edge (m2-1-2)
        (m2-1-1) edge (m2-2-1);
endtikzpicture

vspace11mm
subfloat[]
begintikzpicture
matrix (m3) [M]

    a_31  &  a_32  \
    a_21  &  a_22  \
    a_21  &  a_22  \
;
%
path   (m3-1-2) edge (m3-2-2)
        (m3-2-1) edge (m3-3-1);
endtikzpicture
hfil
subfloat[]
begintikzpicture
matrix (m4) [M]

    a_31  &  a_32  \
    a_21  &  a_22  \
    a_21  &  a_22  \
;
path   (m4-1-2) edge (m3-2-2)
        (m3-3-1) edge (m3-3-2);
endtikzpicture
    captionmy 2 x 2 images
    labelfig:fourimages
endfigure
enddocument

El resultado es el mismo que antes.

Una solución con tabular:

documentclassarticle
usepackagetikz
usetikzlibraryshapes,backgrounds,calc
begindocument
begintabular[email protected]hspace1cmc%@space between columns
    begintikzpicture[shorten >=1pt,node distance=1cm,font = tiny,auto]%,on grid
    tikzstylestate=[shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt]

    node[state] (a31) $a_31$;
    node[state,above of=a31] (a21) $a_21$;
    node[state,  very thick, above of=a21] (a11) $a_11$;

    node[state,right of=a11] (a12) $a_12$;
    node[state,below of=a12] (a22) $a_22$;
    node[state,below of=a22] (a32) $a_32$;
    endtikzpicture
&
    begintikzpicture[shorten >=1pt,node distance=1cm,font = tiny,auto]%,on grid
        tikzstylestate=[shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt]
        node[state] (a31) $a_31$;
        node[state,above of=a31] (a21) $a_21$;
        node[state, very thick, above of=a21] (a11) $a_11$;

        node[state,right of=a11] (a12) $a_12$;
        node[state,below of=a12] (a22) $a_22$;
        node[state,below of=a22] (a32) $a_32$;

        path[->,draw,thick]
        (a11) edge node (a12)
        (a11) edge node (a21);
    endtikzpicture\[1cm]%space betweem rows 
    begintikzpicture[shorten >=1pt,node distance=1cm,font = tiny,auto]%,on grid
        tikzstylestate=[shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt]

        node[state] (a31) $a_31$;
        node[state,above of=a31] (a21) $a_21$;
        node[state, very thick, above of=a21] (a11) $a_11$;

        node[state,right of=a11] (a12) $a_12$;
        node[state,below of=a12] (a22) $a_22$;
        node[state,below of=a22] (a32) $a_32$;

        path[->,draw,thick]
        (a12) edge node (a22)
        (a21) edge node (a31);
    endtikzpicture
&
     begintikzpicture[shorten >=1pt,node distance=1cm,font = tiny,auto]%,on grid
        tikzstylestate=[shape=circle,thick,draw,minimum width=+2ex,minimum height=+3ex,inner sep=+.2pt]

        node[state] (a31) $a_31$;
        node[state,above of=a31] (a21) $a_21$;
        node[state, very thick, above of=a21] (a11) $a_11$;

        node[state,right of=a11] (a12) $a_12$;
        node[state,below of=a12] (a22) $a_22$;
        node[state,below of=a22] (a32) $a_32$;

        path[->,draw,thick]
        (a12) edge node (a22)
        (a31) edge node (a32);
endtikzpicture\
endtabular
enddocument

tabla de tikzpictures

Esta respuesta usa una matriz de dos formas diferentes. O una matriz de picso usando matrices para dibujar los sub-diagramas. Desafortunadamente, no se pueden anidar matrices … todavía.

Matriz de fotos: Puede definir una imagen para las cosas que se repiten y una macro simple para agregar las flechas. De esa forma no tendrás que repetir tantas cosas. los pic se puede definir de tal manera que solo necesita especificar las flechas, p. ej.

picscheme=11->12,11->21;

rendimientos

ingrese la descripción de la imagen aquí

La imagen completa se obtiene con

    matrix[column sep=1cm,row sep=1cm] 
        picscheme; & picscheme=11->12,11->21;\
        picscheme=12->22,21->31; & picscheme=12->22,31->32;\
        ;

ingrese la descripción de la imagen aquí

La distancia entre los nodos del círculo está controlada por node distance, y la distancia entre los bloques por row sep y column sep, respectivamente.

Este es el código completo:

documentclass[tikz]standalone
usetikzlibrarypositioning

begindocument
begintikzpicture[shorten >=1pt,node distance=1em,font = tiny,auto,
    state/.style=shape=circle,draw,minimum width=+2ex,minimum
    height=+3ex,inner sep=+.2pt,arr/.style=->,thick,draw,
    pics/scheme/.style=code=%
    path foreach X [count=mycolumn] in -0.5,0.5
    foreach Y [count=myrow] in 1,0,-1
    (X,Y) node[state,
        line width=0.6pt+ifthenelse(myrow+10*mycolumn==11,1,0)*0.4pt
        ] 
        (-myrow-mycolumn) 
    $a_myrowmycolumn$ 
    ;
    defArrDraw##1##2->##3##4;
    draw[arr] (-##1-##2) -- (-##3-##4);
    edeftempnonenone%
    edeftemparg#1%
    unlessifxtempargtempnone
    foreach X in #1
    expandafterArrDrawX;
    fi 
    ,pics/scheme/.default=none]
    matrix[column sep=1cm,row sep=1cm] 
        picscheme; & picscheme=11->12,11->21;\
        picscheme=12->22,21->31; & picscheme=12->22,31->32;\
        ;
endtikzpicture
enddocument

Usando matrices para los sub-diagramas: Cada uno de estos diagramas es un sencillo matrix of nodes, que se puede completar automáticamente. positioning le permite colocar estas matrices entre sí.

documentclass[tikz]standalone
usetikzlibrarypositioning,matrix

begindocument
begintikzpicture[shorten >=1pt,node distance=1cm,font = tiny,auto,
    state/.style=shape=circle,thick,draw,minimum width=+2ex,minimum
    height=+3ex,inner sep=+.2pt,arr/.style=->,very thick,draw,
    mymat/.style=matrix of nodes,nodes in empty cells,column sep=1em,
    row sep=1em,cells=nodes=state,execute at begin node=%
    $a_thepgfmatrixcurrentrowthepgfmatrixcurrentcolumn$]%,on grid
   matrix[mymat]  (mat11)  & \ 
        & \
        & \;
   matrix[mymat,right=of mat11] (mat12)  [very thick];
   draw[arr] (mat12-1-1) --    (mat12-1-2);
   draw[arr] (mat12-1-1) --    (mat12-2-1);
   matrix[mymat,below=of mat11] (mat21)  [very thick];
   draw[arr] (mat21-1-2) --    (mat21-2-2);
   draw[arr] (mat21-2-1) --    (mat21-3-1);
   matrix[mymat,right=of mat21] (mat22)   ;
   draw[arr] (mat22-1-2) --    (mat22-2-2);
   draw[arr] (mat22-3-1) --    (mat22-3-2);
endtikzpicture
enddocument

ingrese la descripción de la imagen aquí

APÉNDICE: Es muy fácil integrar subtítulos en esto.

documentclassarticle
usepackagetikz
usepackagesubcaption
usetikzlibrarycalc,positioning
tikzset
    state/.style=shape=circle,draw,minimum width=+2ex,minimum
    height=+3ex,inner sep=+.2pt,arr/.style=->,thick,draw,
    pics/scheme/.style=code=%
    beginscope[local bounding box=-bb]
    path foreach X [count=mycolumn] in -0.5,0.5
      foreach Y [count=myrow] in 1,0,-1
      (X,Y) node[state,
          line width=0.6pt+ifthenelse(myrow+10*mycolumn==11,1,0)*0.4pt
          ] 
          (-myrow-mycolumn) 
      $a_myrowmycolumn$ 
      ;
    endscope
    tikzsetie86/.cd,#1
    ,ie86/.cd,arrows/.code=defArrDraw##1##2->##3##4;
    draw[arr] (-##1-##2) -- (-##3-##4);
    edeftempnonenone%
    edeftemparg#1%
    unlessifxtempargtempnone
    foreach XX in #1
    expandafterArrDrawXX;
    fi,arrows/.default=none,
    caption/.code=path let p1=($(-bb.east)-(-bb.west)$) in
     (-bb.south) node[below,text width=x1,align=center,font=normalsize] 
     beginsubfigurex1
     caption#1
     endsubfigure;
begindocument
beginfigure
centering
begintikzpicture[shorten >=1pt,node distance=1em,font = tiny]
    matrix[column sep=6mm,row sep=6mm] 
        picscheme=caption=abc; & 
        picscheme=arrows=11->12,11->21,caption=;\
        picscheme=arrows=12->22,21->31,caption=blub; &
        picscheme=arrows=12->22,31->32,caption=bla;\
        ;
endtikzpicture
captionSeveral graphs.
endfigure
enddocument

ingrese la descripción de la imagen aquí

Si estás contento con lo expuesto, tienes la libertad de dejar un artículo acerca de qué te ha gustado de este enunciado.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *