function plot_solution(R, n, u)
% PLOT_SOLUTION -- Plot solution to the linear system.
%
% SYNOPSIS:
%   plot_solution(R, n, u)
%
% PARAMETERS:
%   R   - `Region name'.  See SETUP for details on supported names.
%   n   - Number of sub-intervals in each direction.
%   u   - Solution to linear system as a column vector.
%
% RETURNS:
%   Nothing.
%
% SEE ALSO:
%   SETUP.
 
G = numgrid(R, n+1);
U = G;
msk = G > 0;
U(msk) = full(u(G(msk)));
x = linspace(-1, 1, n+1);

alph = 0.685;
beta = 0.4;
m    = 2^16;

% Colour map
cmap = zeros(m, 3);
cmap(:,2) = linspace(0, 1, m).';
cmap(:,3) = cmap(end:-1:1, 2);
cmap = brighten(cmap, beta);

figure
make_plot(x, x, U, cmap, alph)

figure
make_plot(x, x, U, cmap, alph)
view(2)
colorbar


function make_plot(x, y, u, cmap, alph)
colormap(cmap);
surf(x, y, u, 'FaceColor', 'interp', 'EdgeColor', 'none');
alpha(alph);
camlight right, camlight left
xlabel('x'), ylabel('y'), title('Temperature distribution')
