Graphics, Figures & TablesTikz Chart Arrows

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

Tikz Chart Arrows

Post by nerazzurri53 »

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

\usepackage{tikz,pgfplots}
\usetikzlibrary{shapes, arrows,positioning}
\tikzset{
    >=stealth',
    punkt/.style={
           rectangle,
           draw=black, thick,
           text width=6.5em,
           minimum height=2em,
           text centered},
    % Define arrow style
    pil/.style={
           ->,
           thick,
           shorten <=2pt,
           shorten >=2pt,}
}
\tikzstyle{linepart} = [draw, thick, dashed]
\begin{tikzpicture}[auto]
\draw [very thick] [->](0,0)--(13,0)node[above left]{$t$};
\draw [very thick] [->](0,0)--(0,6.4) node[right]{$L$};
\draw (0,0)--(1.5,2.2);
\draw (1.5,0)--(3.4772,2.9);
\draw (1.5,2.2)--(6.0835,3.8055);
\draw (3.4772,0)--(6.0835,3.8055);
\draw [very thick](0.2,2.2)--(-0.2,2.2) node[left]{$q_{1}$};
\draw [very thick](0.2,2.9)--(-0.2,2.9) node[left]{$q_{2}$};
\draw [very thick](0.2,3.8055)--(-0.2,3.8055) node[left]{$q_{3}$};
\draw [very thick](3.4772,2.9)--(6.0835,0);
\draw [very thick](1.5,2.2)--(3.4772,0);
\draw [very thick](9.5036,0)--(6.0835,3.8055);
\draw [ultra thin, dashdotted](1.5,0) -- (1.5,2.2); 
\draw [ultra thin, dashdotted](3.4772,0) -- (3.4772,2.9); 
\draw [ultra thin, dashdotted](6.0835,0) -- (6.0835,3.8055); 
\draw[decorate,decoration={brace,amplitude=8pt}] (1.5,-0.2) -- (0,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{1})$};
\draw[decorate,decoration={brace,amplitude=8pt}] (3.4772,-0.2) -- (1.5,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{2})$};
\draw[decorate,decoration={brace,amplitude=8pt}] (6.0835,-0.2) -- (3.4772,-0.2) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{3})$};
\draw[decorate,decoration={brace,amplitude=8pt}] (3.4772,-1.5) -- (1.5,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p1}(q_{2})$};
\draw[decorate,decoration={brace,amplitude=8pt}] (6.0835,-1.5) -- (3.4772,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p2}(q_{2})$};
\draw[decorate,decoration={brace,amplitude=8pt}] (9.5036,-1.5) -- (6.0835,-1.5) node[midway, below,yshift=-1.8ex]{$t_{p2}(q_{3})$};
\end{tikzpicture}
Attachments
WeChat Image_20200601172616.png
WeChat Image_20200601172616.png (62.56 KiB) Viewed 11588 times
t Image_20200601154138.png
t Image_20200601154138.png (88.37 KiB) Viewed 11594 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Tikz Chart Arrows

Post by Bartman »

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

A suggestion:

Code: Select all

\documentclass[border=5pt]{standalone}
\usepackage{tikz}% pgfplots loads tikz, which loads graphicx

\usetikzlibrary{shapes,arrows.meta,positioning,matrix}

\tikzset{>=Stealth}

\begin{document}
\begin{tikzpicture}[
    thick,
    box/.style={
        draw, 
        text width=6em, 
        align=center,
        minimum height=1cm
    }
]
\begin{scope}[nodes=box, node distance=.5cm and 2cm]
\node (man) {Manufacturer};
\node (re1) [above right=of man] {Retailer 1};
\node (re2) [below right=of man] {Retailer 2};
\node (cus) [below right=of re1] {Customers};
\end{scope}

% arrows
\draw [->,dashed] 
    (re1) --+ (0,1.5) node [above] (a1) {$a_1$}
;
\draw [->,dashed] 
    (re2) --+ (0,-1.5) node [below] (a2) {$a_2$}
;

% legend
\matrix [
    matrix of nodes,
    draw,
    anchor=east,
    inner ysep=1.5pt,
    nodes={anchor=west},
    nodes in empty cells,
    column 1/.style={minimum width=8mm}
] at (a1-|cus.east) (legend) {
    & Flow of goods\\
    & Cash flow\\
};

% more arrows
\draw [->] (legend-1-1.west) -- (legend-1-1.east);
\draw [->,dashed] (legend-2-1.west) -- (legend-2-1.east);

\path [->] 
    ([yshift=4mm]man.east) 
        edge node [above=1mm] {$D_{1}$} 
    ([yshift=1.5mm]re1.west)
;
\path [->,dashed] 
    ([yshift=-1.5mm]re1.west) 
        edge node [below=1mm] {$\omega D_{1}$} 
    ([yshift=1mm]man.east)
    
    % bend arrow
    ([xshift=-3mm]man.north east) 
        edge [out=70, in=130, looseness=1.5] 
            node [pos=.65, above=1mm] {$ta_1$}
    ([xshift=3mm]re1.north west)
;
\path [->]
    (man) edge (re2)
    (re1) edge (cus)
    (re2) edge (cus)
;
\end{tikzpicture}
\end{document}
nerazzurri53
Posts: 2
Joined: Mon Jun 01, 2020 3:37 pm

Tikz Chart Arrows

Post by nerazzurri53 »

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: 369
Joined: Fri Jan 03, 2020 2:39 pm

Tikz Chart Arrows

Post by Bartman »

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.
Post Reply