Please consider this MWE:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\usetikzlibrary{arrows,overlay-beamer-styles,babel,arrows.meta, patterns}
\pgfplotsset{compat=1.8}
% ========================
% From https://tex.stackexchange.com/a/76014/152550
\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{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=\tiny},
yticklabel style = {font=\tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
xticklabel=\empty,
yticklabel=\empty,
]
\addplot[very thick,red] {0.5x+1};
\addplot[very thick,red] {-2x+3};
%\addplot[draw=none,pattern=vertical lines,green,opacity=0.3] {0.5x+1}\drawge;
%\addplot[draw=none,pattern=vertical lines,blue,opacity=0.3] {0.5x+1}\drawle;
%\addplot[draw=none,pattern=vertical lines,orange,opacity=0.3] {-2x+3}\drawge;
%\addplot[draw=none,pattern=vertical lines,violet,opacity=0.3] {-2x+3}\drawle;
\end{axis}
\end{tikzpicture}
\end{document}
I would like to fill the 4 regions that are divided into the plane, with no-overlapping of solid colors (including the red lines). If we uncomment the last four \addplot we get:
As you can see:
- The four
\addplotcolors are overlapping, and - The red lines overlap with the 4 colors.
How can we prevent the overlapping between area colors and line colors?
P.S. I should be able to add a 3rd red line to the above, and paint the regions with 7 different colors in total.




