function coins_average_plot ( m, n, v, label, filename )

%*****************************************************************************80
%
%% coins_average_plot() plots the running average of M sets of N coin tosses.
%
%  Discussion:
%
%    Note that this function does not call CLF to clear the figure.
%    Therefore, invoking the function twice in a row will
%    show both the old and new plots together.  This operation can be
%    repeated.  Since we expect the plots to show similar behavior
%    towards the right, this may be a useful feature.  If not,
%    call clf, or uncomment the "clf" below.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the number of repetitions.
%
%    integer N, the number of tosses.
%
%    real V(M,N), the toss results, -1 or +1.
%
%    string LABEL, a label for the plot.
%
%    string FILENAME, a name for the plot file.
%
  a = r8row_running_average ( m, n, v );

  ip1 = 1 : n + 1;

  clf ( );
  hold on
  plot ( ip1, a, 'b.-', 'MarkerSize', 25, 'LineWidth', 2 );
  xlabel ( '<-- Tosses -->', 'FontSize', 16 )
  ylabel ( 'Running Average', 'FontSize', 16 )
  title ( label );
  limits = axis;
  limits(3) = -1.1;
  limits(4) = +1.1;
  axis ( limits );
  hold off

  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Saving a copy of this plot in "%s"\n', filename );

  return
end
