function [tx, ty, tz] = TernTics(theAxes, nDimensions, theColor)

% TernGrid -- Grid for TernPlot.
 
% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
% All Rights Reserved.
 
% Version of 12-Sep-96 at 11:33:23.5.

if nargin < 1, theAxes = gca; end
if nargin < 2, nDimensions = 4; end
if nargin < 3, theColor = ':y'; end

[x, y, z] = TernGrid(theAxes, nDimensions);

nans = x .* NaN;

dx = sign(diff(x)) .* 0.025;
dy = sign(diff(y)) .* 0.025;
dz = sign(diff(z)) .* 0.025;
x = [x(1, :); x(1,:)+dx; nans; x(2, :)-dx; x(2, :)];
y = [y(1, :); y(1,:)+dy; nans; y(2, :)-dy; y(2, :)];
z = [z(1, :); z(1,:)+dz; nans; z(2, :)-dz; z(2, :)];

if nargout < 2
   axes(theAxes)
   if nDimensions == 3
      h = TernPlot(x, y, theColor);
     else
      h = TernPlot(x, y, z, theColor);
   end
   if nargout > 0, tx = h; end
  else
   tx = x; ty = y; tz = z;
end
