function tplot3(m,com,n0,n1,n2)
% tplot3: plots thermodynamic property data
% function tplot3(m,com,n0,n1,n2)
% Turns the plot hold OFF.
% Plots column n2 vs column n1 in m with lines of constant
%    column n0 connected by solid lines and marked with 
%    different symbols.
% Adds title and axis labels.
%      Argument List
% Arg   Specifies
%  m   matrix of data from thermo properties FORTRAN program.
% com  name of the compound.
%  n0  column with data to sort on: 1 is p, 2 is t
%  n1  column of data for x axis
%  n2  column of data for y axis
%      If these are not given, 0.1 is used for each.
%       Values of nk
%  k    Specifies
%  1   Pressure kPa
%  2   Temperature C
%  3   Volume m3/kg
%  4   Entropy kJ/kg-K
%  5   Enthalpy kJ/kg
%  6   Int. Eng. kJ/kg
%  7   Gibbs Eng. kJ/kg
%  8   Helm. Eng. kJ/kg
cols='mcrgbk';
ck=1;
maxp=50;
m1=m;
hold off
     if n1<=6
        xs=m(:,n1);
     else
        TS=(m(:,2)+273.15).*m(:,4);
        if n1==7
           xs=m(:,5)-TS;
        else
           xs=m(:,6)-TS;
        end
     end
     if n2<=6
        ys=m(:,n2);
     else
        TS=(m(:,2)+273.15).*m(:,4);
        if n2==7
           ys=m(:,5)-TS;
        else
           ys=m(:,6)-TS;
        end
     end
xx=max(xs);
xn=min(xs);
yx=max(ys);
yn=min(ys);

labs=['Pressure kPa   '
      'Temperature C  '
      'Volume m3/kg   '
      'Entropy kJ/kg-K'
      'Enthalpy kJ/kg '
      'Int. Eng. kJ/kg'
      'Gibbs En. kJ/kg'
      'Helm. En. kJ/kg']; 
con=[];
for k=1:maxp
  i1=find(m1(1,n0)==m1(:,n0));
  i2=find(m1(1,n0)~=m1(:,n0));
  m2=m1(i1,:);
  m1=m1(i2,:);
  [nra,nca]=size(m2);
  if nra>2
    nr=floor(k/5);
    if k-nr*5==0
     end
     con=cgrp(con,num2str(m2(1,n0)));
     if n1<=6
        xs=m2(:,n1);
     else
        TS=(m2(:,2)+273.15).*m2(:,4);
        if n1==7
           xs=m2(:,5)-TS;
        else
           xs=m2(:,6)-TS;
        end
     end
     if n2<=6
        ys=m2(:,n2);
     else
        TS=(m2(:,2)+273.15).*m2(:,4);
        if n2==7
           ys=m2(:,5)-TS;
        else
           ys=m2(:,6)-TS;
        end
     end
     plot(xs,ys,cols(ck))
     ck=ck+1;
     if ck>length(cols)
          ck=1;
     end
     if k==1
        hold on
     end
  end
  axis([xn,xx,yn,yx])
  if length(m1)==0
     break
  end
end
xlabel(labs(n1,:))
ylabel(labs(n2,:))
title([com,' Lines of constant ',labs(n0,:)])
legend(con)
