function pwc_patch_2d ( nxc, nyc, xc, yc, vc )

%*****************************************************************************80
%
%% pwc_patch_2d() plots a piecewise constant function of (X,Y) as patches.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 April 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer NXC, NYC, the number of columns and rows of data.
%
%    real XC(NXC+1), YC(NYC+1), the breakpoint coordinates.
%
%    real VC(NXC,NYC), the values.
%
  figure ( );
  for i = 1 : nyc
    y = [ yc(i), yc(i), yc(i+1), yc(i+1) ];
    for j = 1 : nxc
      x = [ xc(j), xc(j+1), xc(j+1), xc(j) ];
      patch ( x, y, vc(j,i), 'EdgeColor', 'k' );
    end
  end

  xlabel ( '<--- X --->', 'fontsize', 12 );
  ylabel ( '<--- Y --->', 'fontsize', 12 );
  zlabel ( '<--- Z(X,Y) --->', 'fontsize', 12 );
  datestring = datestr ( datevec ( now ), 0 );
  title ( { 'pwc patch 2d'; datestring }, 'fontsize', 16 );
  colorbar ( );
  filename = 'pwc_patch_2d.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );

  return
end
