Problem drawing boxes with arrows in tikZ

by naveganteX   Last Updated April 16, 2019 05:23 AM

Could someone, whenever it's possible, post a minimal tikZ example to draw this? I also would like to put an "R" inside the upper box. This is mi code so far (I know, it's a mess):

\documentclass[tikz]{standalone}
\begin{document}
\tikzstyle{vspecies}=[rectangle, minimum size=0.5cm,draw=black,fill=blue]
\begin{tikzpicture}

\node [vspecies] (I) {I} ;
\node [vspecies, above left of = I] (N) {M} ;
\node [vspecies, below left of = I] (K) {K} ;
\draw [->,thick] (S.south east) --  node {\small{$N$}}  (M) ; ;
\draw [->,thick] (C) --  node [below right]    {\small{$M$}} (M) ;

\end{tikzpicture}
\end{document}

enter image description here

Tags : tikz-pgf


Answers 1


Something like this?

\documentclass[tikz,margin=1mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\begin{scope}[local bounding box=a]
    \node[minimum width=2cm,minimum height=3cm,draw] (main-a) {};
    \path (main-a.west) node[left] {$N$} (main-a.north) node[above] {$M$};
\end{scope}
\begin{scope}[local bounding box=b2]
    \node[minimum width=2cm,minimum height=1cm,draw,below right=of main-a] (main-b2) {};
    \path (main-b2.east) node[right] {$K$} (main-b2.north) node[above] {$M$};
\end{scope}
\begin{scope}[local bounding box=b1]
    \node[minimum width=1cm,minimum height=3cm,draw,below left=of main-a] (main-b1) {};
    \path (main-b1.west) node[left] {$N$} (main-b1.north) node[above] {$K$};
\end{scope}
\draw[-stealth] (main-a.south) -- (b1.north east);
\draw[-stealth] (main-a.south) -- (b2.north west);
\end{tikzpicture}
\end{document}

enter image description here

JouleV
JouleV
April 16, 2019 05:22 AM

Related Questions


Updated November 20, 2018 12:23 PM

Updated December 20, 2018 03:23 AM

Updated December 17, 2018 22:23 PM

Updated December 18, 2018 02:23 AM

Updated July 16, 2018 08:23 AM