function president_heights_barh ( )

%*****************************************************************************80
%
%% president_heights_barh creates a horizontal bar chart, using the readtable command.
%
%  Discussion:
%
%    Standard MATLAB file reading functions like load() and csvread()
%    cannot read files of data in columns when some data is numeric, and
%    some is text.
%
%    The readtable() function handles this case, but creates a special
%    structure called a table, to store the data.  Individual columns
%    can be accessed using the same curly bracket indexing used for
%    cell arrays.  There are probably other wonderful features.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 April 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'president_heights_barh\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Create a horizontal bar plot of the height in inches of US presidents.\n' );
%
%  Read the file.
%
  height = load ( 'president_heights_data.txt' );
%
%  Plot heights.
%
  barh ( height );
%
%  Set labels.
%
  set ( gca, 'yticklabel', { ...
    "George Washington", ...
    "John Adams", ...
    "Thomas Jefferson", ...
    "James Madison", ...
    "James Monroe", ...
    "John Quincy Adams", ...
    "Andrew Jackson", ...
    "Martin van Buren", ...
    "William Harrison", ...
    "John Tyler", ...
    "James Polk", ...
    "Zachary Taylor", ...
    "Millard Fillmore", ...
    "Franklin Pierce", ...
    "James Buchanan", ...
    "Abraham Lincoln", ...
    "Andrew Johnson", ...
    "Ulysses Grant", ...
    "Rutherford Hayes", ...
    "James Garfield", ...
    "Chester Arthur", ...
    "Grover Cleveland 1", ...
    "Benjamin Harrison", ...
    "Grover Cleveland 2", ...
    "William McKinley", ...
    "Theodore Roosevelt", ...
    "William Taft", ...
    "Woodrow Wilson", ...
    "Warren Harding", ...
    "Calvin Coolidge", ...
    "Herbert Hoover", ...
    "Franklin Roosevelt", ...
    "Harry Truman", ...
    "Dwight Eisenhower", ...
    "John Kennedy", ...
    "Lyndon Johnson", ...
    "Richard Nixon", ...
    "Gerald Ford", ...
    "Jimmy Carter", ...
    "Ronald Reagan", ...
    "George Bush I", ...
    "Bill Clinton", ...
    "George Bush II", ...
    "Barack Obama", ...
    "Donald Trump" } );

  xlabel ( '<-- Height (inches) -->', 'Fontsize', 16 );
  title ( 'US President Heights', 'Fontsize', 16 );
  grid ( 'on' );
  filename = 'president_heights_barh.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'president_heights_barh\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

