LaTeX forum ⇒ Graphics, Figures & TablesTikz Chart Arrows

Information and discussion about graphics, figures & tables in LaTeX documents.
nerazzurri53
Posts: 2
Joined: Mon Jun 01, 2020 3:37 pm

Tikz Chart Arrows

Postby nerazzurri53 » Mon Jun 01, 2020 3:45 pm

Hi everyone,

I am a beginner in Latex. Just now I tried to make a chart with four elements, see Attachment.
Here is my code, i don't quite know about how to create exact the arrows as shown in the example.can anyone be helpful? The bend arrows are from my code.
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \usepackage{tikz,pgfplots}
  2. \usetikzlibrary{shapes, arrows,positioning}
  3. \tikzset{
  4. >=stealth',
  5. punkt/.style={
  6. rectangle,
  7. draw=black, thick,
  8. text width=6.5em,
  9. minimum height=2em,
  10. text centered},
  11. % Define arrow style
  12. pil/.style={
  13. ->,
  14. thick,
  15. shorten <=2pt,
  16. shorten >=2pt,}
  17. }
  18. \tikzstyle{linepart} = [draw, thick, dashed]
  19. \begin{tikzpicture}[auto]
  20. \draw [very thick] [->](0,0)--(13,0)node[above left]{$t$};
  21. \draw [very thick] [->](0,0)--(0,6.4) node[right]{$L$};
  22. \draw (0,0)--(1.5,2.2);
  23. \draw (1.5,0)--(3.4772,2.9);
  24. \draw (1.5,2.2)--(6.0835,3.8055);
  25. \draw (3.4772,0)--(6.0835,3.8055);
  26. \draw [very thick](0.2,2.2)--(-0.2,2.2) node[left]{$q_{1}$};
  27. \draw [very thick](0.2,2.9)--(-0.2,2.9) node[left]{$q_{2}$};
  28. \draw [very thick](0.2,3.8055)--(-0.2,3.8055) node[left]{$q_{3}$};
  29. \draw [very thick](3.4772,2.9)--(6.0835,0);
  30. \draw [very thick](1.5,2.2)--(3.4772,0);
  31. \draw [very thick](9.5036,0)--(6.0835,3.8055);
  32. \draw [ultra thin, dashdotted](1.5,0) -- (1.5,2.2);
  33. \draw [ultra thin, dashdotted](3.4772,0) -- (3.4772,2.9);
  34. \draw [ultra thin, dashdotted](6.0835,0) -- (6.0835,3.8055);
  35. \draw[decorate,decoration={brace,amplitude=8pt}] (1.5,-0.2) -- (0,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{1})$};
  36. \draw[decorate,decoration={brace,amplitude=8pt}] (3.4772,-0.2) -- (1.5,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{2})$};
  37. \draw[decorate,decoration={brace,amplitude=8pt}] (6.0835,-0.2) -- (3.4772,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{3})$};
  38. \draw[decorate,decoration={brace,amplitude=8pt}] (3.4772,-1.5) -- (1.5,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{2})$};
  39. \draw[decorate,decoration={brace,amplitude=8pt}] (6.0835,-1.5) -- (3.4772,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p2}(q_{2})$};
  40. \draw[decorate,decoration={brace,amplitude=8pt}] (9.5036,-1.5) -- (6.0835,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p2}(q_{3})$};
  41. \end{tikzpicture}
Attachments
WeChat Image_20200601172616.png
WeChat Image_20200601172616.png (62.56 KiB) Viewed 308 times
t Image_20200601154138.png
t Image_20200601154138.png (88.37 KiB) Viewed 314 times

Bartman
Posts: 76
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Mon Jun 01, 2020 6:05 pm

Please provide a complete example and use the BBCode to highlight your source code.

A suggestion:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[border=5pt]{standalone}
  2. \usepackage{tikz}% pgfplots loads tikz, which loads graphicx
  3.  
  4. \usetikzlibrary{shapes,arrows.meta,positioning,matrix}
  5.  
  6. \tikzset{>=Stealth}
  7.  
  8. \begin{document}
  9. \begin{tikzpicture}[
  10. thick,
  11. box/.style={
  12. draw,
  13. text width=6em,
  14. align=center,
  15. minimum height=1cm
  16. }
  17. ]
  18. \begin{scope}[nodes=box, node distance=.5cm and 2cm]
  19. \node (man) {Manufacturer};
  20. \node (re1) [above right=of man] {Retailer 1};
  21. \node (re2) [below right=of man] {Retailer 2};
  22. \node (cus) [below right=of re1] {Customers};
  23. \end{scope}
  24.  
  25. % arrows
  26. \draw [->,dashed]
  27. (re1) --+ (0,1.5) node [above] (a1) {$a_1$}
  28. ;
  29. \draw [->,dashed]
  30. (re2) --+ (0,-1.5) node [below] (a2) {$a_2$}
  31. ;
  32.  
  33. % legend
  34. \matrix [
  35. matrix of nodes,
  36. draw,
  37. anchor=east,
  38. inner ysep=1.5pt,
  39. nodes={anchor=west},
  40. nodes in empty cells,
  41. column 1/.style={minimum width=8mm}
  42. ] at (a1-|cus.east) (legend) {
  43. & Flow of goods\\
  44. & Cash flow\\
  45. };
  46.  
  47. % more arrows
  48. \draw [->] (legend-1-1.west) -- (legend-1-1.east);
  49. \draw [->,dashed] (legend-2-1.west) -- (legend-2-1.east);
  50.  
  51. \path [->]
  52. ([yshift=4mm]man.east)
  53. edge node [above=1mm] {$D_{1}$}
  54. ([yshift=1.5mm]re1.west)
  55. ;
  56. \path [->,dashed]
  57. ([yshift=-1.5mm]re1.west)
  58. edge node [below=1mm] {$\omega D_{1}$}
  59. ([yshift=1mm]man.east)
  60.  
  61. % bend arrow
  62. ([xshift=-3mm]man.north east)
  63. edge [out=70, in=130, looseness=1.5]
  64. node [pos=.65, above=1mm] {$ta_1$}
  65. ([xshift=3mm]re1.north west)
  66. ;
  67. \path [->]
  68. (man) edge (re2)
  69. (re1) edge (cus)
  70. (re2) edge (cus)
  71. ;
  72. \end{tikzpicture}
  73. \end{document}

nerazzurri53
Posts: 2
Joined: Mon Jun 01, 2020 3:37 pm

Postby nerazzurri53 » Mon Jun 01, 2020 10:26 pm

Hi Bartman,

thank you for the prompt answer!
Could you pls explain what the 'yshift' and east mean?
and: out=70, in=130, looseness=1.5, what do they stand for?
Sorry i am completely new about Latex.

Bartman
Posts: 76
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Tue Jun 02, 2020 12:44 am

You will find descriptions and examples of everything in the manual of pgf/TikZ. In my opinion, the yshift option is self-explanatory. east is an anchor name. The options out, in and looseness are used in different contexts, in this case with the edge operation.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests