figlines.m (946B)
1 function []=figlines(x,y,yesdot,dotlabel,justone,linewidth); 2 3 % Add dashed lines from (x,ymin) to (x,y) and (xmin,y) to (x,y). 4 % Add a dot at (x,y) if yesdot==1; 5 % justone='x' then just draw the vertical line at position x 6 % justone='y' then just draw the horizontal line. 7 % justone='n' then don't draw either line, just dot/label. 8 9 cax=axis; 10 xmin=cax(1); 11 ymin=cax(3); 12 if ~exist('justone'); justone='b'; end; 13 if ~exist('linewidth'); linewidth=1; end; 14 15 hold on; 16 %plot([x x],[ymin y],'g:','LineWidth',1.5); 17 %plot([xmin x],[y y],'g:','LineWidth',1.5); 18 if justone=='x' | justone=='b'; 19 plot([x x],[ymin y],'r--','LineWidth',linewidth); 20 end; 21 if justone=='y' | justone=='b'; 22 plot([xmin x],[y y],'r--','LineWidth',linewidth); 23 end; 24 25 if exist('yesdot'); 26 if yesdot; 27 plot(x,y,'o','MarkerFaceColor','r'); 28 if exist('dotlabel'); 29 text(x,y,dotlabel,'HorizontalAlignment','left','VerticalAlignment','bottom','FontSize',16); 30 end; 31 end; 32 end;