0

Can you guys help me doing those things like the one that is signed/encircled in the picture below?

\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    [scale=30,line cap=round,line join=round,x=0.06cm,y=0.03cm]
%\draw[mygreen!20, fill = mygreen!20] (0,0.5)--(0,1.375)--(4.2,0.325)--(4.0,-0.5)--(2,0)--cycle; 
\draw[very thick, ->, >=stealth] (-0,0) -- (4.5,0) node[anchor=north] {Tempo};
\draw[very thick,->, >=stealth] (0,0) -- (0,4.5) node[anchor=east] {Nível de Inventário};

\draw[very thick, domain=0:1.5, black!70, opacity=0.9, samples=200] plot (\x,{(-3*\x+3)});  
\draw [very thick, black!70, samples=200, dashed] (1.5,-3/2) -- (1.5,3);
\draw[very thick, domain=1.5:3, black!70, opacity=0.9, samples=200] plot (\x,{(-3*\x+7.5)});
\draw [very thick, black!70, samples=200, dashed] (3,-3/2) -- (3,3);    
\end{tikzpicture}
\end{document}

enter image description here

1 Answer 1

3
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
        [scale=30,line cap=round,line join=round,x=0.06cm,y=0.03cm]
        %\draw[mygreen!20, fill = mygreen!20] (0,0.5)--(0,1.375)--(4.2,0.325)--(4.0,-0.5)--(2,0)--cycle; 
        \draw[very thick, ->, >=stealth] (-0,0) -- (4.5,0) node[anchor=north] {Tempo};
        \draw[very thick,->, >=stealth] (0,0) -- (0,4.5) node[anchor=east] {Nível de Inventário};

        \draw[very thick, domain=0:1.5, black!70, opacity=0.9, samples=200] plot (\x,{(-3*\x+3)});  
        \draw [very thick, black!70, samples=200, dashed] (1.5,-3/2) -- (1.5,3);
        \draw[very thick, domain=1.5:3, black!70, opacity=0.9, samples=200] plot (\x,{(-3*\x+7.5)});
        \draw [very thick, black!70, samples=200, dashed] (3,-3/2) -- (3,3);    
        \draw[fill = black] (0,0) node[anchor=north east, rotate=0] {$0$}; 
        \draw[fill = black] (1.5,0) node[anchor=north east, rotate=0] {$T$};
        \draw[fill = black] (3,0) node[anchor=north east, rotate=0] {$T$};  
        \draw [very thick, |-, black!70, samples=200, dashed] (-0.40,0) -- (-0.40,1.2); 
        \draw [very thick, -|, black!70, samples=200, dashed] (-0.40,1.8) -- (-0.40,3); 
        \draw[fill = black] (-0.40,1.5) node[ rotate=0] {\small$Q-L_E$};
        \draw [very thick, |-, black!70, samples=200, dashed] (1.7,0) -- (1.7,-0.5);
        \draw [very thick, -|, black!70, samples=200, dashed] (1.7,-1) -- (1.7,-3/2);
        \draw[fill = black] (1.7,-0.65) node[rotate=0] {\small$L_E$};
        \end{tikzpicture}
\end{document}

enter image description here

3
  • 1
    Instead of the three lines that draw the top, bottom and label of the Q-L_E thing on the left, you can do it in one line with \draw [very thick, |-|, black!70, samples=200, dashed] (-0.40,0) to node[black,fill=white] {\small$Q-L_E$} (-0.40,3); May 31, 2020 at 6:52
  • Thank you for your improvement! Another thing, what does the samples thing on drawing settings do?
    – davids_73
    May 31, 2020 at 16:12
  • 1
    In your case, that does nothing. I think it is meant for curves, to make them less jagged. That is, if there are more samples on a path, it will be smoother. May 31, 2020 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.