function lab03_4 ( )

%*****************************************************************************80
%
%% LAB03_4 creates a (horizontal) bar plot of schoolyear lengths.
%
%  Discussion:
%
%    For a horizontal bar plot, it's easier to label each bar in a readable way.
%
%    Ordinarily, I would prefer to read the data from a file.  However,
%    MATLAB has some difficulty dealing with data files that include text 
%    fields.  Rather than try to use "readtable", I supply the data with
%    a function.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    10 December 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'LAB03_4:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Get data of country names and school year lengths.\n' );
  fprintf ( 1, '  Make a horizontal bar plot, with labeled bars.\n' );
%
%  Get the data.
%
  [ country, days ] = schoolyear_data ( );
%
%  Make a horizontal bar plot.
%
  barh ( days )
  set ( gca, 'yticklabel', country );
  grid ( 'on' )
  xlabel ( '<-- School Year in Days -->', 'FontSize', 16 )
  title ( 'International Variation in School Year', 'FontSize', 24 )
%
%  Save a snapshot of the plot.
%
  filename = 'lab03_4.png';
  print ( '-dpng', filename )
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'LAB03_4:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
function [ country, days ] = schoolyear_data ( )

%*****************************************************************************80
%
%% SCHOOL_YEAR defines the school year data.
%
%  Discussion:
%
%    Average number of days in a school year, for various countries,
%    as reported in 1990.
%
%  Modified:
%
%    19 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Output, cell array COUNTRY(28), the country names.
%
%    Output, integer SCHOOLYEAR(28), the school year length in days.
%
  country = { ...
    'Belgium (French)', ...
    'Belgium (Flemish)', ...
    'British Columbia', ...
    'England', ...
    'Finland', ...		
    'France', ...
    'Hong Kong', ...
    'Hungary', ...
    'Ireland', ...
    'Israel', ...
    'Japan', ...
    'Luxembourg', ...
    'Netherlands', ...
    'New Brunswick', ...
    'New Zealand', ...
    'Nigeria', ...
    'Ontario', ...
    'Quebec', ...
    'Scotland', ...
    'South Korea', ...
    'Soviet Union', ...
    'Spain', ...
    'Sweden', ...
    'Switzerland', ...
    'Thailand', ...
    'United States', ...
    'West Germany', ...
    'Wales' };

  days = [ ...
    175, ...
    160, ...
    185, ...
    192, ...
    190, ...	
    185, ...
    195, ...
    192, ...
    184, ...
    216, ...
    243, ...
    216, ...
    200, ...
    182, ...
    190, ...
    190, ...
    185, ...
    180, ...
    200, ...
    220, ...
    211, ...
    180, ...
    180, ...
    191, ...
    200, ...
    180, ...
    253, ...
    192 ];

  return
end

