function grid_fill_contour ( )

%*****************************************************************************80
%
%% grid_fill_contour creates a color contour plot from a table Z(X,Y).
%
%  Discussion:
%
%    Here, the grid is a 41x41 array of equally spaced points in [-2,2]x[-2,2].
%
%      x = linspace ( -2.0, +2.0, 41 );
%      y = linspace ( -2.0, +2.0, 41 );
%      [ X, Y ] = meshgrid ( x, y );
%
%    and Z(X,Y) is a function which can be evaluated in MATLAB by:
%
%      Z = exp ( - ( X.^2 + Y.^2 ) ) ...
%       .* cos ( 0.25 * X ) ...
%       .* sin ( Y ) ...
%       .* cos ( 2 * (X.^2 + Y.^2 ) );
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 July 2020
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'grid_fill_contour:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Make a filled color contour plot Z(X,Y) for a 41x41 table.\n' );

  xyz = load ( 'grid_data.txt' );

  x = reshape ( xyz(:,1), 41, 41 );
  y = reshape ( xyz(:,2), 41, 41 );
  z = reshape ( xyz(:,3), 41, 41 );
%
%  Choose a range for the levels.
%
  zmax = max ( max ( z ) );
  zmin = min ( min ( z ) );
  zdel = ( zmax - zmin ) / 15;
  zlevels = zmin : zdel : zmax;
%
%  Set up a colormap.
%
  colormap ( jet );
%
%  Display a contour plot.
%
  contourf ( x, y, z, zlevels );
%
%  CAXIS allows us to define the color bar using the minimum and maximum U
%  over the whole data set.
%
  caxis ( [ zmin, zmax ] );
%
%  Place a colorbar on the plot.
%
  colorbar ( )
%
%  Label the axes and the plot.
%
  xlabel ( '<--- X --->', 'Fontsize', 16 );
  ylabel ( '<--- Y --->', 'Fontsize', 16 );
  title ( 'Filled contour plot of grid data', 'Fontsize', 16 );
%
%  Save the plot as a PNG file.
%
  filename = 'grid_fill_contour.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'grid_fill_contour:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end
