How can I get the following figure using Tikz environment please?
2 Answers
An alternative starting point to make own solution. To understand code, I suggest you to read TikZ manual, chapter: "TikZ ist kein Zeichenprogram".
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{arrows.meta, positioning}
\begin{document}
\begin{tikzpicture}[
node distance = 12mm,
box/.style = {draw, rounded corners, minimum width=22mm, minimum height=9mm,
inner sep=2mm},
arr/.style = {draw=gray, ultra thick,-{Triangle[fill=gray]},
shorten < = 2mm, shorten > = 2mm}
]
\node (n1) [box] {Text 1};
\node (n2) [box,right=of n1] {Text 2};
\node (n3) [box,below=of n1] {Text 3};
\node (n4) [box,below=of n2] {Text 4};
%
\draw[arr] (n1) edge (n2) (n1) edge (n3) (n2) edge (n4) (n3) edge (n4);
\end{tikzpicture}
\end{document}
There are several answers of how you can position nodes relatively. I would choose this way.
Since I am not allowed to comment, I added an answer with a little example code.
The basic idea is to start with one node at a random place, give it a label (1) and position all other nodes relative to this one. Also I used a style to define the size and the dimensions.
Since I do not know how much to explain, please ask if something is not clear.
\documentclass[tikz, border=2pt]{standalone}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[
block/.style = {%
rectangle,
minimum width = 2cm,
minimum height = 1cm,
node distance = 3cm,
draw = black,
}
]
% nodes
\node[block] (1) at (0,0) {Text 1};
\node[block, right of = 1] (2) {Text 2};
\node[block, below of = 2, yshift = 1cm] (4) {Text 4};
\node[block, below of = 1, yshift = 1cm] (3) {Text 3};
% lines
\draw[->] (1) -- (2);
\draw[->] (2) -- (4);
\draw[->] (3) -- (4);
\draw[->] (1) -- (3);
\end{tikzpicture}
\end{document}