reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

axispercent.m (733B)


      1 function []=axispercent(whichaxis,x100);
      2 
      3 % function []=axispercent(whichaxis);
      4 %
      5 %  whichaxis='x' or 'y'
      6 %  x100=100 if we should first multiply the axis by 100
      7 %
      8 %  Convert the axis tick labels from 1 2 3 to 1% 2% 3%
      9 %  or .01 .02 .03 to 1% 2% 3% if x100=100
     10 
     11 if exist('x100')~=1; x100=1; end;
     12 
     13 if whichaxis=='x';
     14   tick='XTick';
     15   ticklabel='XTickLabel';
     16 else;
     17   tick='YTick';
     18   ticklabel='YTickLabel';
     19 end;
     20 
     21 % Convert y-axis values to percentage values by multiplication
     22 a=[cellstr(num2str(get(gca,tick)'*x100))]; 
     23 
     24 % Create a vector of '%' signs
     25 pct = char(ones(size(a,1),1)*'%'); 
     26 
     27 % Append the '%' signs after the percentage values
     28 new_ticks = [char(a),pct];
     29 
     30 % 'Reflect the changes on the plot
     31 set(gca,ticklabel,new_ticks) ;