reverse-shooting

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

logscale.m (874B)


      1 function []=logscale(whichaxis,axlabel); 
      2 %function []=logscale(axlabel); Takes current
      3 % plot, assumes it is the plot of x versus log(y), and relabels the y axis
      4 % axlabel is the string to use to label the y axis.
      5 
      6 % Now fix the log scale for the y axis.
      7 %val=[1000 2000 4000 8000 16000 32000]';
      8 %labs=strmat('1000 2000 4000 8000 16000 32000');
      9 
     10 if exist('whichaxis')~=1;
     11    whichaxis='Y'; 			% default to Y axis
     12 end;
     13 
     14 if exist('axlabel')~=1;
     15    if whichaxis=='Y';
     16       curlabs=get(gca,'YTickLabel');
     17    else;
     18       curlabs=get(gca,'XTickLabel');
     19    end;
     20    newnum=exp(str2num(curlabs));
     21    labs=num2str(newnum,'%6.0f');
     22    logval=log(round(newnum));
     23 else;
     24    labs=strmat(axlabel);
     25    logval=log(str2num(axlabel));
     26 end;
     27 
     28 if whichaxis=='Y';
     29    set(gca,'YTickLabel',labs);
     30    set(gca,'YTick',logval);
     31 else;
     32    set(gca,'XTickLabel',labs);
     33    set(gca,'XTick',logval);
     34 end;
     35