If you use a positive amplitude
and the mirror
option then you get the correct brace (color added):
Notes:
- As pointed out by Charles Staats, another option would be to use positive lengths, and reverse the order in which the coordinates are specified -- then you don't need the
mirror
option.
Code:
\documentclass[a4paper,fleqn]{article}
\usepackage{amssymb,amsthm,tikz,fancyhdr,cancel,enumerate,array,booktabs,setspace,pgf,tikz,fancyhdr,graphicx,color}
\usepackage[T1]{fontenc}
\usetikzlibrary{patterns,arrows,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.6091370558375635cm,y=0.9589041095890412cm]
\draw[->,color=black] (-1,0) -- (18.7,0);
\foreach \x in {-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}
\draw[shift={(\x,0)},color=black] (0pt,-2pt);
\draw[color=black] (18.05,0.05) node [anchor=south west] { Time};
\draw[->,color=black] (0,-1) -- (0,6.3);
\foreach \y in {-1,1,2,3,4,5,6}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\draw[color=black] (0.09,6.04) node [anchor=west] { Stock Level};
\clip(-1,-1) rectangle (18.7,6.3);
\draw (0,3)-- (3,0);
\draw (4.5,3)-- (3,0);
\draw (4.5,3)-- (7.5,0);
\draw (7.5,0)-- (9,3);
\draw (9,3)-- (12,0);
\draw (13.5,3)-- (12,0);
\draw (0,3)-- (5,3);
\draw (6.4,4.78) node[anchor=north west] {$gradient=r_s-r_d$};
\draw (10.22,4.76) node[anchor=north west] {$gradient=-r_d$};
\draw [->] (7.43,4.29) -- (8.66,2.32);
\draw [->] (11.01,4.26) -- (9.76,2.33);
\draw (-0.45,4.79) node[anchor=north west] {$Q$};
\draw (-0.5,3.36) node[anchor=north west] {$q$};
\draw (2.5,5)-- (7.5,0);
\draw (3,0)-- (3,5);
\draw (0,4.5)-- (3.5,4.5);
\draw (13.5,3)-- (16.5,0);
\draw (16.5,0)-- (18,3);
\draw (18,3)-- (21,0);
\draw [thick, red,decorate,decoration={brace,amplitude=10pt,mirror},xshift=0.4pt,yshift=-0.4pt](3,0) -- (7.5,0) node[black,midway,yshift=-0.6cm] {\footnotesize $t$};
\draw [thick, blue,decorate,decoration={brace,amplitude=5pt,mirror},xshift=0.4pt,yshift=-0.4pt](12,0) -- (13.5,0) node[black,midway,yshift=-0.6cm] {\footnotesize $\frac{q}{r_s-r_d}$};
\draw [thick, brown, decorate,decoration={brace,amplitude=10pt,mirror},xshift=0.4pt,yshift=-0.4pt](13.5,0) -- (16.5,0) node[black,midway,yshift=-0.6cm] {\footnotesize $\frac{q}{r_s}$};
\end{tikzpicture}
\end{document}
I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
Best Answer
As suggested in Andrew's answer that Seamus linked to, you can use a
brace
decoration for this. If it's on the wrong side of your path, use themirror
option (or reverse the path order). To increase the spacing, you can useraise=<length>
: