function [ ] = plot_options(Fmat, xmat)

% This function provides a variety of options for plotting 
% Pareto optimal solutions in the x-space and F-space

numpts = size(Fmat,1);

fprintf('Pick one of the following plotting options\n');
fprintf('by entering the corresponding line number:\n\n');

disp('1.  2-D plot of f_i vs f_j (any two functions, f_i on vertical axis)')
disp('2.  3-D plot of f_i, f_j and f_k')
disp('3.  Plot of x_i vs f_j')
disp('4.  Plot of x_i vs (f_j , f_k) pairs')
disp('5.  Plot of T(f_i) vs f_j (T is a transformation function on f_i)')
disp('6.  Plot of T(x) vs f_i (T is a new function of x)')
disp('7.  Plot of T(x) vs (f_i , f_j) pairs')

disp(' ')

choice = input('Enter line number: (1-7)     ');


if ((choice == 1)|(choice == 3))|((choice == 5)|(choice == 7)),
	v = input('Enter i, j in an array as [i,j]    ');
	i = v(1); j = v(2);
    elseif (choice == 2)|(choice == 4),
	v = input('Enter i, j, k in an array as [i, j, k]   ');
	i = v(1); j = v(2); k = v(3);
	    elseif (choice == 6),
		i = input('Enter i   ');
end

if (choice >= 5)
	% Read in transformation T
	fprintf('Enter the transformation T as a character string\n');
	fprintf('(This can be the name of the function.m file');
	Tstring = input(' where you have defined the transformation)  ');
end

axis('auto')

if (choice == 1),
	plot(Fmat(:,i), Fmat(:,j), 'r*');

	xlabel('f_j')
	ylabel('f_i')
   elseif (choice == 2)
	plot3(Fmat(:,i), Fmat(:,j), Fmat(:,k), 'r*');
        xlabel('f_i')
	ylabel('f_j')
	zlabel('f_k')     
      elseif (choice == 3)
  	   plot(Fmat(:,j), xmat(:,i), 'r*')
	   ylabel('x_i')
	   xlabel('f_j')
	  elseif (choice == 4)  
		% x_i vs f_j and f_k
	      vcoord = min(xmat(:,i)) - 0.1*mean(abs(xmat(:,i)));	
	      plot3(Fmat(:,j), Fmat(:,k), vcoord*ones(numpts,1), 'b-', Fmat(:,j), Fmat(:,k), xmat(:,i), 'r*');
	      xlabel('f_j'); ylabel('f_k'); zlabel('x_i');

		elseif (choice == 5)
		  % Plot T(f_i) vs f_j
		  T_of_fi = zeros(numpts,1);
		  for r = 1:numpts
			T_of_fi(r) = feval(Tstring, Fmat(r,i));
		  end
		  plot(Fmat(:,j), T_of_fi, 'r*', Fmat(:,j), T_of_fi, 'b--')
		  ylabel('T(f_i)')
		  xlabel('f_j')
			
			elseif (choice == 6)
			  % Plot T(x) vs f_i
			  T_of_x = zeros(numpts,1);
			  for r = 1:numpts
				T_of_x(r) = feval(Tstring, xmat(r,:));
		  	  end	
			  plot(Fmat(:,i), T_of_x, 'r*')
			  ylabel('T(x)')
			  xlabel('f_i')

				elseif (choice == 7)
				   % Plot T(x) vs f_i and f_j
				    T_of_x = zeros(numpts,1);
				    for r = 1:numpts
				       T_of_x(r) = feval(Tstring, xmat(r,:));
		  	  	    end

		vcoord = min(T_of_x) - 0.1*mean(abs(T_of_x));	

	      plot3(Fmat(:,i), Fmat(:,j), vcoord*ones(numpts,1), 'b+', Fmat(:,i), Fmat(:,j), T_of_x, 'r*');
	      xlabel('f_i'); ylabel('f_j'); zlabel('T(x)');

end % main if


% Offer print options

save_plot = input('Save plot to a .ps file ? (1 for yes, anything else for no)  ');
if (save_plot == 1)
	enter_title = input('Want to enter a title for the plot ? (1 for yes) ');
	if (enter_title == 1)
		plot_title = input('Enter title in single quotes  ');
		eval(['title(' 'plot_title' ')']);
	end

	axes_relabel;

	filename = input('Enter name of file with .ps extension (in single quotes)   ');
	eval(['print -depsc ' filename]);
end

