I'm trying to shade the feasible region ABCDE but for some reason, only get a weird line. This is the code:
\begin{tikzpicture}
% axes
\begin{axis}[axis on top,smooth,
axis line style=very thick,
axis x line=bottom,
axis y line=left,
ymin=0,ymax=17,xmin=0,xmax=17,
xlabel=$x_1$, ylabel=$x_2$,grid=major
]
% constraints
\draw [name path global=xaxis] (0,0) -- (17,0);
\draw [name path=yaxis] (0,0) -- (0,17);
\addplot[name path global=firstline,very thick, domain=0:17]{6-0.5*x};
\addplot[name path global=secondline,very thick, domain=0:17]{3+0.5*x};
\addplot[name path global=thirdline,very thick, domain=0:17]{16-2*x};
\addplot[name path global=fourthline,very thick, domain=0:17]{7};
% feasible area
\fill[name intersections={of=xaxis and yaxis,by=point1},
name intersections={of=secondline and yaxis,by=point2},
name intersections={of=firstline and secondline,by=point3},
name intersections={of=firstline and thirdline,by=point4},
name intersections={of=thirdline and xaxis,by=point5},
][very thick,draw=orange,pattern=crosshatch dots,pattern color=green!60!white](point1)--(point2)--(point3)--(point4)--(point5)--(point1);
% intersection points name
\node[] at (axis cs:0.5,0.7){\small{$A$}};
\node[] at (axis cs:0.5,3.9){\small{$B$}};
\node[] at (axis cs:3,5.2){\small{$C$}};
\node[] at (axis cs:6.8,3.9){\small{$D$}};
\node[] at (axis cs:8.2,0.7){\small{$E$}};
\end{axis}
\end{tikzpicture}
Most of the code is taken from one of the responses (cmhughes) here: How to draw the region of inequality? Thanks for any insights.
EDIT: Following marmot suggestion, I've added \pgfplotsset{compat=1.15} (or whatever version supported) to the preamble and that solved the problem.

\documentclass[tikz,border=3.14mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \usetikzlibrary{intersections,patterns} \begin{document}and of course put\end{document}at the end. To understand where your problem comes from, you need to provide the complete preamble, i.e. an MWE. – Aug 24 '18 at 15:57name intersections={of=firstline and secondline,by=point2a}(which represents C) and add this node to your drawing. Adding--cyclemay also help. However, I also cannot reproduce your problem and the area is drawn nicely with marmot’s minimal wrapper. – Jasper Habicht Aug 24 '18 at 16:34