# Illustrate segments along a function in tikz

What is a good way to illustrate certain intervals along a curve? I start a MC-curve. Between SR and LR there should be one additional line-segment. Finally a third line starts at LR on MC. All in all, I not only have three segments in different color (this could be achieved by defining the MC-function on domain=0:15/4, domain=15/4:4.77 and domain=4.77:6).

I need some overlay (transparent?) oder jitter feature (shift left, right?) to show all three graphs in parallel. In the given picture, read line should be "red and blue" and the brown line should be "red, blue and brown". Colour could also be dash-features or the like.

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]
\addplot+[no marks,domain=0:6,samples=200, thick] {12/5 * x^2 - 12*x + 15 } node[right,font=\tiny] {MC};
\addplot+[no marks,domain=15/4:6,samples=200, thick] {12/5 * x^2 - 12*x + 15 } node[right,font=\tiny] {SR};
\addplot+[no marks,domain=4.777:6,samples=200, thick] {12/5 * x^2 - 12*x + 15 } node[right,font=\tiny] {LR};
\addplot+[no marks,domain=0:8.5,samples=200, thick] {4/5 * x^2 - 6*x + 15 + 75/(2*x)} node[right,font=\tiny] {ATC};
\addplot+[no marks,domain=0:8.5,samples=200, thick] {4/5 * x^2 - 6*x + 15} node[right,font=\tiny] {AVC};
\filldraw (15/4,15/4) circle (1.5pt) node[below right,font=\tiny] {SR};
\filldraw (4.777,12.44) circle (1.5pt) node[above left,font=\tiny] {LR};
\end{axis}
\end{tikzpicture}

\end{document}


Welcome to TeX-SE! Yes, you can shift these curves.

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}

\begin{tikzpicture}[declare function={f(\x)=12/5 * \x*\x - 12*\x + 15; }]
\begin{axis}[axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]
\addplot+[no marks,domain=0:6,samples=200, thick] {f(x)} node[right,font=\tiny] {MC};
\addplot+[xshift=-2pt,no marks,domain=15/4:6,samples=200, thick] {f(x)};% node[right,font=\tiny] {SR};
\addplot+[xshift=2pt,no marks,domain=4.777:6,samples=200, thick] {f(x)};% node[right,font=\tiny] {LR};
\addplot+[no marks,domain=0:8.5,samples=200, thick] {4/5 * x^2 - 6*x + 15 + 75/(2*x)} node[right,font=\tiny] {ATC};
\addplot+[no marks,domain=0:8.5,samples=200, thick] {4/5 * x^2 - 6*x + 15} node[right,font=\tiny] {AVC};
\filldraw (15/4,15/4) circle (1.5pt) node[below right,font=\tiny] {SR};
\filldraw (4.777,12.44) circle (1.5pt) node[above left,font=\tiny] {LR};
\end{axis}
\end{tikzpicture}

\end{document}


• Thank you, looks like shifting is an easy way to do it. By the way, can you tell me, why the automatic color choice uses blue twice? – Marco Feb 26 at 14:50