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

%*****************************************************************************80
%
%% coins_sum_barchart() makes a bar chart of M instances of N coin tosses.
%
%  Discussion:
%
%    Our barchart will display the frequency of the number of heads
%    between 0 and N.
%
%    For usable plots, you want N to be relatively low (like 5 or 10)
%    while M can be large, like 50, or 100, or 10,000.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 February 2016
%
%  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.
%
  clf ( );
%
%  W contains the row sums, between 0 and N.
%
  w = ( sum ( v, 2 ) + n ) / 2;

  hist ( w );

  grid ( 'on' );
  title ( label );
  limits = axis;
  limits(1) = - 0.5;
  limits(2) = n + 0.5;
  limits(3) = 0;
%
%  For a particular run, I want to compare two plots so I need
%  to fix limits(4) to this otherwise random number!
%
  limits(4) = 300;
  axis ( limits );

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

  return
end
