[Tex/LaTex] Plotting 6 Linear functions in one graph

pgfplotsplot

i am stuck about drawing 6 linear functions in one graph which are

  • f_1(x)= 18x-9
  • f_2(x)= -17x+8
  • f_3(x)= -12x+6
  • f_4(x)= 4x-2
  • f_5(x)= -3x+1
  • f_6(x)= (\Pi /2)x

f_i : [0,1]-> R where i=1,2,..6 .Thanks in advance

So far I rearrange my code as

\begin{tikzpicture}%[scale=1.0]
    \begin{axis}[
width=10cm,
xlabel=$x$, ylabel=$\varphi_{i}(x)$,
ymin=-10,axis on top=true,
axis x line=middle,
axis y line=middle, 
grid=major,
legend pos=outer north east
                    ]
\addplot [blue, line width = 1, smooth, domain=0:1] {18*x-9};
\addplot [red, line width=1,smooth,domain=0:1] {-17*x +8};
\addplot [yellow, line width=1,smooth,domain=0:1] {-12*x+6};
\addplot [green, line width=1,smooth,domain=0:1] {4*x-2};
\addplot [pink, line width=1,smooth,domain=0:1] {-3*x+1};
\addplot [orange, line width=1,smooth,domain=0:1] {(3/2) *x};

\node [fill=black, circle, scale=0.3] at (axis cs: {10/21},{-3/7}) {};
\node [fill=black, circle, scale=0.3] at (axis cs: {1/2},{-1/2}) {};
\node [below left] at (axis cs: {1/2},{-1/2}) {$\frac{10}{21},\frac{-3}{7}$};
\node [below right] at (axis cs: {1/2},{-1/2}) {$(\frac{1}{2},\frac{-1}{2}$};

\legend  {$\varphi_1 (x)=18 x - 9$,
          $\varphi _2 (x)=-17x+8$,
          $\varphi_3 (x)=-12x+6$,
          $\varphi_4 (x)=4x-2$,
          $\varphi_5 (x)=-3x+1$,
          $\varphi_6 (x)=x{\displaystyle\pi/2}$
         };
    \end{axis}
\end{tikzpicture}

but i have problems in put name on intersection point. they are not look good as much as i think 🙂

Best Answer

As Zarko said, TeX Stack Exchange is usually not the do-it-for-me site, but since you're new, I'll make an exception. We're going to plot with tikz and pgfplots packages (and amsmath, in case you use any exotic symbols). Here is our code.

\documentclass{article}

\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}

\usepgfplotslibrary{external}

\begin{document}

\begin{tikzpicture}
\begin{axis}[xlabel=$x$,ylabel=$y$,
xmin=-10,xmax=10,ymin=-10,ymax=10, axis lines=center, axis equal]

\addplot[domain=-10:10, color=blue,]{18*x-9};

\addplot[domain=-10:10, color=red,]{-17*x+8};

\addplot[domain=-10:10, color=yellow,]{-12*x+6};

\addplot[domain=-10:10, color=green,]{4*x-2};

\addplot[domain=-10:10, color=pink,]{-3*x+1};

\addplot[domain=-10:10, color=orange,]{pi/2*x};

\end{axis}
\end{tikzpicture}

\end{document}

And here is the result.

enter image description here

UPDATE: Sorry for not including your code in my answer, you posted it after my repsonse was already finished.