function polyiamond_plot ( p, r, name, number )

%*****************************************************************************80
%
%% polyiamond_plot displays a particular polyiamond on a triangular grid.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 September 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer P(M,3): the IJK coordinates of the triangles.
%
%    real R: controls the relative size of the triangles, between 0 and 1.
%
%    string NAME: a title for the plot.
%
%    logical NUMBER: true if the polyiamond triangle indices should be printed.
%
  [ m, k ] = size ( p );
%
%  Determine the size of the necessary background grid.
%
  pmin = min ( p );
  imin = pmin(1) - 1;
  jmin = pmin(2) - 1;
  pmax = max ( p );
  imax = pmax(1) + 1;
  jmax = pmax(2) + 1;
%
%  Fill the grid with pale gray triangles.
%
  clf ( );
  hold ( 'on' );

  r_back = 0.90;
  color_back = [ 0.8, 0.8, 0.8 ];
  label = '';
  for i = imin : imax
    for j = jmin : jmax
      for k = 0 : 1
        triangle_ijk_fill ( i, j, k, r_back, color_back, label );
      end
    end
  end
%
%  Draw the shape using yellow triangles.
%
  color_fore = 'y';
  for l = 1 : m
    i = p(l,1);
    j = p(l,2);
    k = p(l,3);
    label = sprintf ( '%d', l );
    triangle_ijk_fill ( i, j, k, r, color_fore, label );
  end

  hold ( 'off' );

  axis ( 'equal' );
  axis ( 'off' );
  title ( name );

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

  return
end
