function election_box_plot ( )

%*****************************************************************************80
%
%% election_box_plot() creates a box plot of the USA election results.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 November 2020
%
%  Author:
%
%    John Burkardt
%

%
%  Set up a 8x11 board of gray cells on a white background.
%
  clf ( );
  m = 8;
  n = 11;
  r = 0.45;
  white = 'w';
  gray = [ 0.9, 0.9, 0.9 ];
  white = [ 0.0, 0.0, 0.0 ];
  light_red = [ 1.0, 0.7, 0.7 ];
  light_blue = [ 0.7, 0.7, 1.0 ];
  light_gray = [ 0.9, 0.9, 0.9 ];
  light_white = [ 0.99, 0.99, 0.99 ];

  hold ( 'on' );

%   d = max ( 0.5 - r,  0.0 );
    d = 0.0;
%
%  Fill the rectangle with the background color.
%  If I specify the color [1,1,1], which should be WHITE, I get BLACK.  Morons!
%
    fill ( [ -d, n+d, n+d, -d ], [ -d, -d, m+d, m+d ], ...
      light_white, 'edgecolor', 'none' );

    for i = 1 : m

      for j = 1 : n

        box_fill ( m, i, j, light_white, '', '' );

      end
    
    end
%
%  Place red and blue squares.
%
    box_fill ( m, 1, 1, light_red, 'AK', '3' );
    box_fill ( m, 3, 1, light_blue, 'WA', '12' );
    box_fill ( m, 4, 1, light_blue, 'OR', '7' );
    box_fill ( m, 5, 1, light_blue, 'CA', '55' );
    box_fill ( m, 8, 1, light_blue, 'HI', '4' );

    box_fill ( m, 3, 2, light_red, 'ID', '4' );
    box_fill ( m, 4, 2, light_red, 'UT', '6' );
    box_fill ( m, 5, 2, light_blue, 'NV', '6' );
    box_fill ( m, 6, 2, light_blue, 'AZ', '11' );

    box_fill ( m, 3, 3, light_red, 'MT', '3' );
    box_fill ( m, 4, 3, light_red, 'WY', '3' );
    box_fill ( m, 5, 3, light_blue, 'CO', '9' );
    box_fill ( m, 6, 3, light_blue, 'NM', '5' );

    box_fill ( m, 3, 4, light_red, 'ND', '3' );
    box_fill ( m, 4, 4, light_red, 'SD', '3' );
    box_fill ( m, 5, 4, light_red, 'NE', '5' );
    box_fill ( m, 6, 4, light_red, 'KS', '6' );
    box_fill ( m, 7, 4, light_red, 'OK', '7' );
    box_fill ( m, 8, 4, light_red, 'TX', '38' );

    box_fill ( m, 3, 5, light_blue, 'MN', '10' );
    box_fill ( m, 4, 5, light_red, 'IA', '6' );
    box_fill ( m, 5, 5, light_red, 'MO', '10' );
    box_fill ( m, 6, 5, light_red, 'AR', '6' );
    box_fill ( m, 7, 5, light_red, 'LA', '8' );

    box_fill ( m, 4, 6, light_blue, 'WI', '10' );
    box_fill ( m, 5, 6, light_blue, 'IL', '20' );
    box_fill ( m, 6, 6, light_red, 'TN', '11' );
    box_fill ( m, 7, 6, light_red, 'MS', '6' );

    box_fill ( m, 4, 7, light_blue, 'MI', '16' );
    box_fill ( m, 5, 7, light_red, 'IN', '11' );
    box_fill ( m, 6, 7, light_red, 'KY', '8' );
    box_fill ( m, 7, 7, light_red, 'AL', '9' );

    box_fill ( m, 3, 8, light_red, 'OH', '18' );
    box_fill ( m, 4, 8, light_red, 'WV', '5' );
    box_fill ( m, 5, 8, light_red, 'NC', '15' );
    box_fill ( m, 6, 8, light_red, 'SC', '9' );
    box_fill ( m, 7, 8, light_blue, 'GA', '16' );
    box_fill ( m, 8, 8, light_red, 'FL', '29' );

    box_fill ( m, 3, 9, light_blue, 'NY', '29' );
    box_fill ( m, 4, 9, light_blue, 'PA', '20' );
    box_fill ( m, 5, 9, light_blue, 'MD', '10' );
    box_fill ( m, 6, 9, light_blue, 'VA', '13' );

    box_fill ( m, 2, 10, light_blue, 'VT', '3' );
    box_fill ( m, 3, 10, light_blue, 'CT', '7' );
    box_fill ( m, 4, 10, light_blue, 'NJ', '14' );
    box_fill ( m, 5, 10, light_blue, 'DE', '3' );
    box_fill ( m, 6, 10, light_blue, 'DC', '3' );

    box_fill ( m, 1, 11, light_blue, 'ME', '4' );
    box_fill ( m, 2, 11, light_blue, 'NH', '4' );
    box_fill ( m, 3, 11, light_blue, 'MA', '11' );
    box_fill ( m, 4, 11, light_blue, 'RI', '4' );
    box_fill ( m, 8, 11, light_gray, 'PR', '0' );

  hold ( 'off' );

  axis ( 'equal' );
  axis ( 'off' );

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

  return
end
 
