function legendre_plot ( )

%*****************************************************************************80
%
%% legendre_plot plots legendre polynomials.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    24 October 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'legendre_plot:\n' );
  fprintf ( 1, '  legendre_plot plots Legendre polynomials.\n' );

  index = [ 0, 1, 2, 3, 4, 5 ];

  m = 501;
  x = linspace ( -1.0, +1.0, m );
  x = x';

  clf ( );
  hold ( 'on' );
  plot ( [-1.0,+1.0], [0.0,0.0], 'b-', 'Linewidth', 1 );
  for i = 1 : length ( index )
    k = index(i);
    y = legendre_value ( k, x );
    plot ( x, y, 'LineWidth', 3 );
  end
  grid ( 'on' );
  xlabel ( '<--- X --->' );
  ylabel ( '<--- X^k --->' );
  title ( 'legendre Pk(x), k = 0, 1, 2, 3, 4, 5' );
  hold ( 'off' );

  filename = 'legendre_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );

  return
end
