# Plotting 6 Linear functions in one graph

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 [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 :)

• Welcome to TeX.SE! Well, this site (mostly) not provide service "do-it-for-me". Show us, what you try so far and where you stuck in your efforts :). Then we can more easily help you. Also on the right side of your question you have listed to questions related to yours. See, if one of them is useful for you. Mar 24 '17 at 16:38
• i got it sorry for the language that i used :) i spend like 1.5 hours for plotting with the way i know and i am getting and getting error which is " couldn't find the pst-arrow". it was a request :3 Mar 24 '17 at 16:43
• Please show your code. I anticipate, that this error is easy to repair (but not me, I'm not pstricks man :( ) Mar 24 '17 at 16:47
• pst-arrow was recently split from pstricks-add. You probably should update. Which distribution do you have? Mar 24 '17 at 17:14
• That's pgfplots code, what does pstricks or pst-arrow have to do with this? Edit: I changed the tag accordingly. Mar 24 '17 at 18:32

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]

\end{axis}
\end{tikzpicture}

\end{document}


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

• Thank you for being interested in my request, i have also get information from your code. thank you :) Mar 24 '17 at 19:06
• No problem. I'm glad my post helped you. Have a nice day, I wish you lots of success with LaTeX. Mar 24 '17 at 19:08

Perhaps using a pin is a better way of highlighting those intersections. Or are you going to mark more of the intersections?

Note that I simplified the code a bit, moving domain specification and line width setting to the axis options, so that you don't to add it to all the plots.

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\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,
every axis plot/.append style={ %% these will apply to all plots
line width=1pt,
samples=2, % don't need more for straight lines
domain=0:1
}
]

\node [fill=black, circle, scale=0.3, pin=below:{$\bigl(\frac{10}{21},\frac{-3}{7}\bigr)$}] at (axis cs: {10/21},{-3/7}) {};
\node [fill=black, circle, scale=0.3, pin=above:{$\bigl(\frac{1}{2},\frac{-1}{2}\bigr)$}] at (axis cs: {1/2},{-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}
\end{document} • I write xtick={0,1} insted of arraging the points , thanks for the idea :) Mar 24 '17 at 19:05
• @AlperErdem That also removes the grid though. Mar 24 '17 at 19:09
• yes i aware of the consequences of that wrong move :D Mar 24 '17 at 19:14
• @AlperErdem You could try xtick={0,1},grid=both,minor x tick num=4 if you want a grid, but no ticklabels for 0.2,0.4,0.6,0.8. Mar 24 '17 at 19:18