1

Please help me to draw this diagram in LaTeX

enter image description here Thanks in advance for your help.

5
  • 2
    Welcome to TeX.SE! How can we help you? Draw diagram instead of you? Do you try anything so far?
    – Zarko
    Commented Dec 12, 2016 at 3:20
  • I tried but I could not. I don't know to draw with tikz then I saw some models like level diagrams and trees, but didn't help me.
    – Lara
    Commented Dec 12, 2016 at 3:28
  • The site isn't really supposed to do everything for you. Have you looked at the manual? It has several helpful tutorials. Why didn't the models help you? If they didn't help, it is unlikely an answer here will help except with this diagram as a one-off. Will you ever need to draw another diagram?
    – cfr
    Commented Dec 12, 2016 at 3:35
  • 2
    Try drawing it with plain rectangles first - \node makes a rectangle by default. Don't worry about what the result looks like. Concentrate on getting the structure right. Then you can post what you've got if you need help with the style.
    – cfr
    Commented Dec 12, 2016 at 3:37
  • for start search texample.net. There is great number of examples with code and resulted pictures.
    – Zarko
    Commented Dec 12, 2016 at 3:49

2 Answers 2

4

An alternative to your solution:

enter image description here

Main differences in comparison to your solution:

  • as document class is used standalone with option tikz. With it you can see only images. When you are satisfied with result, you can copy code to final document or include it with \input{<path>/<picture file name>}
  • style difinition is part of tikzpicture options (use of tikzstyle is now depreciated, instead it is preferable \tikzset{...}, where styles had to be defined on the same way as in tikzpicture options)
  • for node style I rather use mynode instead of yours node. Use node for style name is not good since it is already defined in TikZ for node ...
  • for shape of main nodes i select signal. Using it I avoid all your scaling of regular polygon and have better control on shape size
  • in positioning of nodes I rather use relative coordinates to coordinate of the main nodes. in this I exploit positioning library. Their distances are controlled by node distance = <vertical> and <horizontal>
  • for drawing arrows I define auxiliary coordinates
  • arrows are grouped by scope regarding their common features (dash pattern, direction)
  • not at the end, I write code in my editor and for shape data look into TikZ & PGF manual, chapter 67 Shape Library, page 693 (shapes signal are described in section 67.4 Symbol Shapes, see page 713).

Complete MWE:

\documentclass[tikz, margin=3mm]{standalone}
    \usetikzlibrary{positioning, shapes.symbols}

\begin{document}
   \begin{tikzpicture}[ 
   node distance = 4mm and 16mm,
mynode/.style = {shape=signal, signal to=west and east,
                 draw, color = #1,
                 text width=1.3cm, align=flush center, 
                 inner xsep=0mm, inner ysep=2mm, font=\small}
                 ]
% main nodes
\node (A) [mynode=magenta]            {Text 2};
\node (B) [mynode=blue, below=of A]   {Text 3};
\node (C) [mynode=teal, below=of B]   {Text 4};
% coordinates for lines
\coordinate[left=of B.west]     (in2);
\coordinate[left=of in2]        (in1);
\coordinate[right=of B.east]    (out1);
\coordinate[right=of out1]      (out2);
% dashed arrows
    \begin{scope}[latex-, dashed, shorten >=1mm]
\draw[magenta] (A.west) -- + (-0.8,0) -- (in2);
\draw[blue]     (B.west) -- (in2);
\draw[magenta] (C.west) -- + (-0.8,0) -- (in2);
    \end{scope}
    \begin{scope}[-latex, dashed, shorten >=1mm]
\draw[magenta] (A.east) -- + (0.8,0) -- (out1);
\draw[blue]     (B.east) -- (out1);
\draw[magenta] (C.east) -- + (0.8,0) -- (out1);
    \end{scope}
% arrows with text
\draw[-latex] (in1) -- node[above] {Text 1} (in2);
\draw[-latex] (out1) -- node[above] {Text 5} (out2);
%--------------
   \end{tikzpicture}
\end{document}
1
  • Thank you very much @Zargo! Your answer and tips will help me learn more about tikz. Soon, I will be able to write this and others codes by hand. :)
    – Lara
    Commented Dec 16, 2016 at 2:11
2

enter image description here

I drew with help of tikzEdit editor (http://www.tikzedt.org/). This is the code that produces the figure

    \documentclass{article}

    \usepackage{tikz}
    \usetikzlibrary{positioning,shapes.geometric,shapes.misc}

   \begin{document}

   \begin{tikzpicture}
   %--------------
   \tikzstyle{node} = [ regular polygon, regular polygon sides=6,xscale=2,draw, 
                        scale=0.5,text centered,text width=1.3cm,inner sep=0pt]
   %--------------
   \node (v1) at (-4.5,3.5) {}; 
   \node (v2) at (-3,3.5) {}; 
   \draw [-latex] (v1) -- node[above] {\small Text 1} (v2);
   %--------------
   \draw [magenta,dashed] (v2) -- (-2.5,5) node (v3) {}; 
   \draw [-latex,magenta,dashed] (v3) -- (-1.5,5);
   \node [node,magenta] (A) at (-0.5,5)    {\small Text 2}; 
   %--------------
   \draw [-latex,blue,dashed] (v2) -- (-1.5,3.5);
   \node [node,blue]   (B) at (-0.5,3.5) {\small Text 3};
   %--------------
   \draw [teal,dashed] (v2) -- (-2.5,2) node (v5) {};
   \draw [-latex,teal,dashed] (v5) -- (-1.5,2);
   \node [node,teal]         (C) at (-0.5,2)    {\small Text 4};
   %--------------
   \node (v6) at (2,3.5) {}; 
   \node (v7) at (3.5,3.5) {}; 
   %--------------
   \draw [magenta,dashed] (0.6,5) -- (1.5,5) node (v8) {};
   \draw [-latex,magenta,dashed] (v8) -- (v6);
   \draw [-latex,blue,dashed](0.6,3.5) -- (v6);
   \draw [teal,dashed] (0.6,2) -- (1.5,2) node (v9) {}; 
   \draw [-latex,teal,dashed](v9) -- (v6);
   %--------------
   \draw [-latex] (v6) -- node[above] {\small Text 5} (v7);
   %--------------
   \end{tikzpicture}

  \end{document}
3
  • 2
    bravo! you are proof for "where is a will there is a way" :)
    – Zarko
    Commented Dec 13, 2016 at 2:58
  • First of all, THANK YOU VERY MUCH @Sebastiano for introducing me to tikzEdt. You were the only person who understood my question. Tikzedt is a great tool for beginners and for those who learn by themselves.
    – Lara
    Commented Dec 16, 2016 at 2:00
  • @Zargo, I never give up!
    – Lara
    Commented Dec 16, 2016 at 2:01

You must log in to answer this question.

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