function basketball_barh ( )

%*****************************************************************************80
%
%% basketball_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 GNU LGPL license.
%
%  Modified:
%
%    27 April 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'basketball_barh\n' );
  fprintf ( 1, '  MATLAB version.\n' );
  fprintf ( 1, '  Create a horizontal bar char from data read using\n' );
  fprintf ( 1, '  the MATLAB command readtable(filename), which\n' );
  fprintf ( 1, '  can be used to read a data file containing data in columns\n' );
  fprintf ( 1, '  some numeric, and some text.\n' );
%
%  Read the file.
%
  data = readtable ( 'basketball_data.csv' );
%
%  Column 2 is Name, Column 6 is sponsorship earnings.
%  Use curly braces for indexing.
%  Order the name and sponsorship data backwards, so it reads from top to
%  bottom on the plot.
%
  barh ( data{end:-1:1,6} );
%
%  Set 30 ticks, so that we have a spot for each name to appear in.
%
  yticks ( 1 : 30 );
  set ( gca, 'yticklabel', data{end:-1:1,2} );

  xlabel ( '<-- Sponsorship Dollars -->', 'Fontsize', 16 );
  title ( 'Who makes the big bucks?', 'Fontsize', 16 );
  grid ( 'on' );

  filename = 'basketball_barh.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'basketball_barh\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

