Graphically Speaking - how weight vector is perpendicular to hyperplane why-is-weight-vector-orthogonal-to-decision-plane-in-neural-networks

vector-orthogonal-to-hyperplane

I wanted to visualize this by drawing a 3d plane where and the weight vector. By definition of the plane, all the points on the plane have the same dot product with the weight vector. 

Question - Why is the weight vector not perpendicular to the plane? Am I mathematically/code wise wrong here or is it that Matlab viewing angle is not appropriate to see the orthogonality of the weight vector (bold arrow) to the plane? Thanks.  

Matlab code below:

w = [0.8 0.3 0.24]  ;%weight vector
%get locus of point whose w'x is same (CONTOUR); x is a vector - (x1 x2 x3)
%randomly choose points from grid and get x3 VALUE

[x1 x2] = meshgrid(-5:0.25:5, -5:0.25:5);
coords = [x1(:) x2(:)];
%say we want to get contour for w'x = 3 
coords(:,3) = (3 - w(1)*coords(:,1) - w(2)*coords(:,2))/w(3)
%plot the plane
scatter3(coords(:,1), coords(:,2),coords(:,3),'MarkerEdgeColor','k','MarkerFaceColor',[0 .75 .75])
view(-10,35);
xlabel('coords(:,1)')
ylabel('coords(:,2)')
zlabel('coords(:,3)')
mArrow3([0 0 0],[8 3 2.4])   %overlay weight vector
p1 = [0 0 0]
p2 = [8 3 2.4]
text(p1(1),p1(2), p1(3), sprintf('(%.0f,%.0f,%.0f)',p1)) %show the origin
%show the weight vector direction
text(p2(1),p2(2), p2(3), sprintf('(%.0f,%.0f, %.0f)',p2))




Another view
I think if you play with the scales of the axes and the viewing angle, you may find it is perpendicular.

Especially, try to rotate the view that you look sideways to the plane. You will see the perpendicular vector (regardless of scale of the other axes).

Any random view angle perpendicular to the weight vector should work.