Hello I am creating a plot using tikz I have created 3 functions on a plot and took the area above each of them using drawge. My question is how I can fill the area above intersection of two functions ? or maybe I should create a polygon with the point of the intersection as one of the points of the polygon? The second part of question is why on x axis the part of the axis is transparent not black? Thank You in advance for answers
the plot looks now like this :
the picture below shows how I want it to look like
here is my current code:
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
\makeatletter
\newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis}
\makeatother
\pgfplotsset{
only axis on top/.style={
axis on top=false,
after end axis/.code={
\pgfplotsset{
axis line style=opaque,
ticklabel style=opaque,
tick style=opaque,
grid=none,
}%
%\pgfplotsdrawaxis
},
},
}
\newcommand{\drawge}{%
-- (rel axis cs:1,0) -- (rel axis cs:1,1) -- (rel axis cs:0,1) \closedcycle
}
\newcommand{\drawle}{%
-- (rel axis cs:1,1) -- (rel axis cs:1,0) -- (rel axis cs:0,0) \closedcycle
}
\begin{tikzpicture} [scale=1.5]
\begin{axis}[only axis on top,
axis line style=very thick,
axis x line=bottom,
axis y line=left,
ymin=0,
ymax=20,
xmin=0,
xmax=20,
xlabel=$y_1$,
ylabel=$y_2$,
grid=major,
ytick={-5,0, 5,10,15,20},
xtick={-5,0,5,10,15,20},
]
\addplot[
very thick,
fill=red!10,
domain=-5:20,
] {(29-6*x)} \drawge;
\addplot[
very thick,
fill=red!10,
domain=-5:20,
] {(29-6*x)} \drawge;
\addplot[
very thick,
fill=yellow!10,
domain=-5:20,
] {(16-4*x)/2} \drawge;
\addplot[very thick, domain=-5:20] {(24-x)/5};
\addplot[very thick, domain=-5:20] {(29-6*x)};
\addplot[very thick, domain=-5:20] {(16-4*x)/2};
\end{axis}
\end{tikzpicture}