function grid_line_contour ( )

%*****************************************************************************80
%
%% grid_line_contour creates a line 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:
%
%    19 July 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'grid_line_contour:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Make a line 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;
%
%  Display a contour plot.
%
  contour ( x, y, z, zlevels, 'linewidth', 3 );
%
%  Label the axes and the plot.
%
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Y --->' );
  title ( 'Grid data line contour plot' );

  pause ( 5 )
%
%  Save the plot as a PNG file.
%
  filename = 'grid_line_contour.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphic saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'grid_line_contour:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end
