2

I have created a phase line diagram before using these two packages. The code is as follows,

\documentclass{amsart}
\usepackage{pgfplots}
\usepackage{tikz}


\newcommand*{\TickSize}{2pt}%

\newcommand*{\AxisMin}{0}%
\newcommand*{\AxisMax}{0}%

\newcommand*{\DrawHorizontalPhaseLine}[4][]{%
% #1 = axis tick labels
% #2 = right arrows positions as CSV
% #3 = left arrow positions as CSV
\gdef\AxisMin{0}%
\gdef\AxisMax{0}%
\edef\MyList{#2}% Allows for #1 to be both a macro or not
\foreach \X in \MyList {
    \draw  (\X,\TickSize) -- (\X,-\TickSize) node [below] {$\X$};
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#3}% Allows for #2 to be both a macro or not
\foreach \X in \MyList {% Right arrows
    \draw [->] (\X-0.1,0) -- (\X,0);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#4}% Allows for #3 to be both a macro or not
\foreach \X in \MyList {% Left arrows
    \draw [<-] (\X-0.1,0) -- (\X,0);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\draw  (\AxisMin-1,0) -- (\AxisMax+1,0) node [right] {#1};
}%

\newcommand*{\DrawVerticalPhaseLine}[4][]{%
% #1 = axis tick labels
% #2 = up arrows positions as CSV
% #3 = down arrow positions as CSV
\gdef\AxisMin{0}%
\gdef\AxisMax{0}%
\edef\MyList{#2}% Allows for #1 to be both a macro or not
\foreach \X in \MyList {
    \draw  (-\TickSize,\X) -- (\TickSize,\X) node [right] {$\X$};
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#3}% Allows for #2 to be both a macro or not
\foreach \X in \MyList {% Up arrows
    \draw [->] (0,\X-0.1) -- (0,\X);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#4}% Allows for #3 to be both a macro or not
\foreach \X in \MyList {% Down arrows
    \draw [<-] (0,\X+0.1) -- (0,\X);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\draw  (0,\AxisMin-1) -- (0,\AxisMax+1) node [above] {#1};
}%
\begin{document}
\begin{tikzpicture}[thick]
\DrawHorizontalPhaseLine[$I$]{-1,0,1,2}{0.25,0.5,0.75} {-0.25,-0.5,-0.75,1.25,1.5,1.75}
\draw[domain=-0.5:1.5,smooth,variable=\x,red] plot ({\x},{-1*(\x-0.5)*  (\x-0.5)+.25});
\end{tikzpicture}
\end{document}

This gives me, enter image description here

However, now I am working with a general case, in which I know that (a-mu)/a >0. Instead of the parabola opening down and crossing at 0 and 1, I want it to open down and cross at 0 and (a-mu)/a > 0. Is this possible?

I have used Drawing phase line for differential equations as a reference.

H5159
  • 213
  • Well, TikZ can only plot an actual plot. It can't draw a general case because such a case cannot be drawn. (It might be represented by a specific case, but the specific instance is what is then drawn to represent the general one.) So, no. You'd have to give it numbers for a and mu else how can it know what they should be? Maybe I just don't understand the question.... – cfr Dec 09 '15 at 03:00
  • @cfr Well I know it would generally be, and that is what I meant, but I have figured it out. I created a phase line without the parabola, and put a nude above a general area of where the tick marker would be, and created the arrows around that. Thank you for your continued help! – H5159 Dec 10 '15 at 00:52
  • Presumably you put the nude in a node? – cfr Dec 10 '15 at 01:25
  • @cfr I meant node haha! – H5159 Dec 10 '15 at 06:39
  • 4
    I'm voting to close this question as off-topic because it was solved in the comments. – Stefan Pinnow Nov 02 '16 at 13:13

0 Answers0