reverse-shooting

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

plotlog1.m (1366B)


      1 function []=plotlog1(x,y,axlabel);
      2 %  function []=plotlog1(x,y,axlabel);
      3 %
      4 %  plotlog1 just drops the 'sym' argument so that I can use multiple
      5 %   linestyles.  See ~/Work/Hall/health/ComputevhRob.m
      6 %
      7 %
      8 %  Plots y vs x with y on a log scale (natural log).
      9 %
     10 %  sym is a symbols argument:  if a string, then just pass it
     11 %     along to plot.  If a vector, then use as plotname.
     12 %
     13 %  axlabel is the string to use to label the y axis.
     14 
     15 plot(x,log(y));
     16 
     17 % Now fix the log scale for the y axis.
     18 %val=[1000 2000 4000 8000 16000 32000]';
     19 %labs=strmat('1000 2000 4000 8000 16000 32000');
     20 if exist('axlabel')~=1;
     21    curlabs=get(gca,'YTickLabel');
     22    newnum=exp(str2num(curlabs));
     23    newlabs=num2str(newnum,'%6.0f');
     24    if size(newlabs,2)==1; 		% Add another significant digit
     25       newlabs=num2str(newnum,'%6.1f');
     26       set(gca,'YTick',log(1/10*round(newnum*10)));
     27    else;
     28       set(gca,'YTick',log(round(newnum)));
     29    end;
     30    set(gca,'YTickLabel',newlabs);
     31 %  Old error:   set(gca,'YTick',str2num(curlabs));  %But there is rounding!!!!
     32 else;
     33    labs=strmat(axlabel);
     34    logval=log(str2num(axlabel));
     35    set(gca,'YTick',logval);
     36    set(gca,'YTickLabel',labs);
     37    % Also adjust YLim in case one of labels is outside the range:
     38    curlim=get(gca,'YLim');
     39    curlim(1)=min([curlim(1) min(logval)]');
     40    curlim(2)=max([curlim(2) max(logval)]');
     41    set(gca,'YLim',curlim);
     42 end;