function genealogy_tree ( )

%*****************************************************************************80
%
%% genealogy_tree makes a tree plot of a genealogy.
%
%  Discussion:
%
%    MATLAB's "treeplot" function is very limited.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 September 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'genealogy_tree:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Plot a tree illustrating a genealogy.\n' );
%
%  Each entry in "nodes" is the "parent" of the given node.
%
  nodes = [ 0, 1, 2, 2, 4, 4, 4, 1, 8, 8, 10, 10 ];
%
%  Display the basic tree.
%
  treeplot ( nodes, 'r*', 'b--'  );
%
%  Assign labels for each node.
%
  labels = { ...
    'Alan',
    'Bert',
    'Chad',
    'Dian',
    'Enid',
    'Fran',
    'Gert',
    'Hank',
    'Iona',
    'Jean',
    'Kate',
    'Lynn' };
%
%  Get the coordinates of each node.
%
  [ x, y ] = treelayout ( nodes );
%
%  Plot the label slightly to the right of the node.
%
  for i = 1 : length ( x )
    text ( x(i) + 0.0125, y(i), labels{i} );
  end
  title ( 'My genealogy tree', 'Fontsize', 16 );
  set ( gca, 'Xtick', [] );
  set ( gca, 'Ytick', [] );

  filename = 'genealogy_tree.png';
  print ( '-dpng', filename );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'genealogy_tree:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end

