Graphics, Figures & Tables ⇒ Parallel Curves (2-6 parallel curves)
Parallel Curves (2-6 parallel curves)
Using tikz, I'm trying to draw two parallel curves and for my purposes - double distance="x"cm - seemed to work. However, I need two different labels for this and I'm not sure how to do this.
For example, if supply shifts right, I want two parallel curves (not lines) to label S1 and S2, but at the moment...I only get S1.
How do I go about this issue? There must be a better method?
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
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: Parallel Curves (2-6 parallel curves)
you can increase the chance of an answer by providing a minimal working example with what you got so far. Adding some visual help, a screenshot, paint foo, a hand drawing, might also help. Right now, at least i don't know what exactly you are looking for.
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Parallel Curves (2-6 parallel curves)
As Johannes said, post the existing drawing as


Stefan
Parallel Curves (2-6 parallel curves)

Code: Select all
\noindent\hspace*{\fill}
\begin{tikzpicture}[scale=0.9]
\usetikzlibrary{calc} %all
% axis
\draw[->] (0,0) -- (6,0) node[right] {$Y$};
\draw[->] (0,0) -- (0,5.5) node[left] {$P$};
\draw[->] (8,0) -- (14,0) node[right] {$Y$};
\draw[->] (8,0) -- (8,5.5) node[left] {$P$};
\def\adone{\x,{(4/\x)}}
\def\easone{-\x+6,{(4/\x}}
\draw[thick, color=red, domain=1:5] plot(\adone) node[right] {AD\textsubscript{0}};
\draw[thick, color=red, domain=1:5, xshift=0.5cm, yshift=0.5cm] plot(\adone) node[right] {AD\textsubscript{1}};
\draw[thick, color=red, domain=1:5, xshift=1cm, yshift=1cm] plot(\adone) node[right] {AD\textsubscript{2}};
\draw[thick, color=blue, domain=1:5] plot(\easone);
\draw[thick, color=blue, domain=1:5, xshift=-0.5cm, yshift=0.5cm] plot(\easone);
\draw[thick, color=blue, domain=1:5, xshift=-1cm, yshift=1cm] plot(\easone);
\draw (4.9,4.1) node[right, color=blue] {EAS\textsubscript{0}};
\draw (4.4,4.6) node[right, color=blue] {EAS\textsubscript{1}};
\draw (3.9,5.1) node[right, color=blue] {EAS\textsubscript{2}};
\draw [dashed] (3.0,1.35) -- (0,1.35) node[left] {P\textsubscript{0}};
\draw [dashed] (3.0,2.1) -- (0,2.1) node[left] {P\textsubscript{1}};
\draw [dashed] (3.0,3.0) -- (0,3.0) node[left] {P\textsubscript{2}};
\draw[thick, color=black] (3.0,5) -- (3.0,0) node[below] {$\bar{Y}$*};
\draw[->, very thick] (3.1,2.2) -- (3.1,2.8);
\draw[->, very thick] (3.1,1.4) -- (3.1,2.0);
\def\adtwo{\x+8,{(4/\x)}}
\def\eastwo{-\x+14,{(4/\x}}
\draw[thick, color=red, domain=1:5] plot(\adtwo) node[right] {AD\textsubscript{0}};
\draw[thick, color=red, domain=1:5, xshift=0.5cm, yshift=0.5cm] plot(\adtwo) node[right] {AD\textsubscript{1}};
\draw[thick, color=blue, domain=1:5] plot(\eastwo);
\draw[thick, color=blue, domain=1:5, xshift=-0.5cm, yshift=0.5cm] plot(\eastwo);
\draw (12.9,4.1) node[right, color=blue] {EAS\textsubscript{0}};
\draw (12.4,4.6) node[right, color=blue] {EAS\textsubscript{1}};
\draw [dashed] (11,1.35) -- (8,1.35) node[left] {P\textsubscript{0}};
\draw [dashed] (11,2.1) -- (8,2.1) node[left] {P\textsubscript{1}};
\draw [dashed] (11,2.1) -- (11,0) node[below] {Y\textsubscript{0}};
\draw [dashed] (11.7,1.7) -- (11.7,0) node[below] {Y\textsubscript{1}};
\draw[->, very thick] (11.1,1.5) -- (11.55,1.8);
\draw[->, very thick] (11.7,1.9) -- (11.2,2.1);
\end{tikzpicture}
\hspace{\fill}
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Parallel Curves (2-6 parallel curves)
- LaTeX macros (as usual),
- TikZ styles,
-
\foreach
loops for repeating things.
Code: Select all
\draw[thick, color=..., domain=1:5]
Code: Select all
\draw[plot, color=...]
\tikzset
:Code: Select all
\begin{tikzpicture}[scale=0.9,
plot/.style = {thick, domain=1:5}
]
You can use loops like this:
Code: Select all
\foreach \i/\x/\y in {1/0cm/0cm, 2/0.5cm/0.5cm, 3/1cm/1cm} {
\draw [plot, color=red, xshift=\x, yshift=\y]
plot(\adone) node[right] {AD\textsubscript{\i}};}
\foreach \x/\y in {0cm/0cm, -0.5cm/0.5cm, -1cm/1cm} {
\draw [plot, color=blue, xshift=\x, yshift=\y]
plot(\easone);}
\foreach
is explained in the 
texdoc tikz
or texdoc pgf
at the command prompt.Stefan