function mortality_to_die_plot ()

%*****************************************************************************80
%
%% mortality_to_die_plot() plots the per bracket "to die" function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 February 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'mortality_to_die_plot():\n' );
  fprintf ( 1, '  mortality_to_die_plot() plots the per bracket "to die" function.\n' );
%
%  Get the data.
%
  [ age_to_die, total_to_die, male_to_die, female_to_die ] = mortality_to_die ( );
%
%  Create the plot.
%
  figure ( );
  clf ( );
  hold ( 'on' );
    plot ( age_to_die, total_to_die, 'k-', 'linewidth', 3 );
    plot ( age_to_die, male_to_die, 'b-', 'linewidth', 3 );
    plot ( age_to_die, female_to_die, 'r-', 'linewidth', 3 );
  hold ( 'off' );
  xlabel ( '<-- Age -->' );
  ylabel ( '<-- Die this age or older -->' );
  title ( 'To die function: 2007' );
  legend ( 'total', 'male', 'female' );
  grid ( 'on' );

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

  return
end
 
