2

I want to draw a diagram like the attached image. can i get some advice enter image description here

enter image description here

1 Answer 1

3

Welcome to TeX.SE! There are several possibilities of achieving this, here is one of them based on the matrix library.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[mymat/.style={matrix of nodes,
nodes={fill=red,draw,text=white,font=\sffamily\bfseries,text width=1.5cm,
text height=11pt,text depth=3pt,baseline=center},
column sep=-\pgflinewidth/2}]
\matrix[mymat] (matTL) {
Text1 & Text2 & Text3\\
};
\matrix[mymat,right=2cm of matTL] (matTR) {
V1 & V2 & V3\\
};
\matrix[mymat,below=2cm of matTL.west,anchor=west] (matBL) {
Text4 & new & Text5 & Text6\\
};
\draw[-latex] (matTL-1-3) -- (matTR-1-1);
\foreach \X in {1,2,3}
{\draw[-latex] (matBL-1-1) -- (matTL-1-\X);}
\end{tikzpicture}
\end{document}

enter image description here

Alternatively you may use shapes.multipart.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.multipart,positioning}
\begin{document}
\begin{tikzpicture}[my shape/.style={rectangle split, rectangle split parts=#1,
fill=red,draw,text=white,font=\sffamily\bfseries,text width=1.5cm,text
height=11pt,text depth=3pt,rectangle split horizontal,
rectangle split part align=base}]
\node [my shape=3] (TL)
{Text1\nodepart{two}Text2\nodepart{three}Text3};
\node [my shape=3,right=2cm of TL] (TR)
{V1\nodepart{two}V2\nodepart{three}V3};
\node [my shape=4,below=2cm of TL.west,anchor=west] (BL)
{Text4\nodepart{two}new\nodepart{three}Text5\nodepart{four}Text6};
\draw[-latex] (TL) -- (TR);
\foreach \X in {one,two,three}
{\draw[-latex] (BL.one north) -- (TL.\X\space south);}
\end{tikzpicture}
\end{document}

enter image description here

7
  • Thank you your solution. I just a have a little issue with it. the cells is not alined. Oct 3, 2018 at 4:16
  • 1
    @user2869180 What do you mean by "not aligned"?
    – user121799
    Oct 3, 2018 at 4:16
  • please check the original post. May be because i add cell to be four and not three cells. Oct 3, 2018 at 4:25
  • 1
    @user2869180 I have fixed that.
    – user121799
    Oct 3, 2018 at 4:33
  • 1
    @user2869180 You need to use the appropriate anchors, e.g. \draw[-latex] (BL.two south) -- (BBL.one north); or \draw[-latex] (BL.two south) to[out=-90,in=90] (BBL.one north);.
    – user121799
    Oct 3, 2018 at 5:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .