I would like to draw the attached diagram, but since it contains colors and texts I couldn't get a good picture. If one can help me with code that would be great. Note, the boxes are of the same size! Thanks.enter image description here

  • I don't see "Post an answer" button. Why is that?
    – Black Mild
    Jun 28, 2019 at 20:15

1 Answer 1


Both a matrix of nodes or tikz-cd allow you to draw this.

 \matrix[matrix of nodes,column sep=3em,row sep=3em,nodes={minimum size=1cm},row 3/.style={nodes=M}] (mat)
 { A & & \\
  \phantom{C} & C & \phantom{F}& F \\
  B & D & |[draw=none,fill=none,minimum size=0em]| \phantom{F}& G\\
 \draw[->] (mat-1-1) edge (mat-3-1)
  (mat-2-1) edge (mat-2-2) 
  (mat-2-2) edge["E"] (mat-3-2)
  (mat-2-4) edge["F"] (mat-3-4)
  (mat-2-2) edge[dashed] (mat-2-4)
  (mat-3-2) edge[dashed] (mat-3-4)
  (mat-2-3) edge[dashed] (mat-3-3);

enter image description here

\tikzset{M/.style={draw=blue,fill=yellow,minimum size=2em}}
\begin{tikzcd}[column sep=3em,row sep=3em]
  A\arrow[dd] & & \\
  \phantom{C} \arrow[r] & C \arrow[d,"E"] \arrow[rr,dashed] & \phantom{F} \arrow[d,dashed]& F \arrow[d,"H"]\\
  |[M]|B  & |[M]|D \arrow[rr,dashed] & \phantom{F}& |[M]|G\\

enter image description here

  • Your are a real TiKznician, @marmot. Or maybe a TiKzizard?
    – Sveinung
    Jun 28, 2019 at 6:49
  • @Sveinung Just a marmot. This is the proof. ;-)
    – user121799
    Jun 28, 2019 at 6:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.