Code covered by the BSD License  

Highlights from
changeloglabels v3

from changeloglabels v3 by Jeffrey
Alters log labels to linear (10^1.45 to 28..). Remakes for zoom/pan. Automatically runs.

changeloglabels
% function changeloglabels
%
% PURPOSE: Function changes the log labels of 10^XX to linear units.  For
% example from 10^1.45 to 28.18.  Recalculates and displays when zoom
% in/out and pan are used.
%
% USE: Function is not actively called.  Place this function in your paths
%      and place the following commands in your startup file.
%
%    set(0,'DefaultFigureCreateFcn','set(zoom,''ActionPostCallback'',''changeloglabels'');set(pan,''ActionPostCallback'',''changeloglabels'')')
%    set(0,'DefaultAxesCreateFcn','proplistener(gca,{''XScale'',''YScale''},''PostSet'',''changeloglabels'')')
%
% Now whenever a log plot is made the axes are remade into linear notation
% without the user having to actively call this function.
%
% OTHER FUNCTIONS:
%   This function relies on the function PROPLISTENER (I.D. #18301, by Yair
%   Altman).  This needs to be put in your path as well to work properly.
%

% Jeffrey A Ballard
% January 15, 2009
% Modified Sept 22, 2009
%   1. Rewrote to work with default settings in startup file so user
%   does not have to actively call funtion

function changeloglabels

hfig  = get(0,'CallbackObject');
hax   = gca;
haxes = findobj(get(hax,'Parent'),'Type','axes');
if ~isprop(hfig,'Description')
    if isempty(findobj(hfig,'Type','axes')); return;end
end

arrayfun(@(x) (set(x,'XTickLabelMode','auto','YTickLabelMode','auto')),haxes)

indx    = arrayfun(@(x) (strcmp(get(x,'XScale'),'log')),haxes);
haxes_x = haxes(indx);

indy    = arrayfun(@(x) (strcmp(get(x,'YScale'),'log')),haxes);
haxes_y = haxes(indy);

for ii=1:length(haxes_x)
    xlabels = get(haxes_x(ii),'XTickLabel');
    xticklabels = cell(1,size(xlabels,1));
    for jj=1:size(xlabels,1)
        xticklabels{jj}=num2str(10^(str2double(strtrim(xlabels(jj,:)))));
    end
    set(haxes_x(ii),'XTickLabel',xticklabels);
end

for ii=1:length(haxes_y)
    ylabels = get(haxes_y(ii),'YTickLabel');
    yticklabels = cell(1,size(ylabels,1));
    for jj=1:size(ylabels,1)
        yticklabels{jj}=num2str(10^(str2double(strtrim(ylabels(jj,:)))));
    end
    set(haxes_y(ii),'YTickLabel',yticklabels);
end

end

Contact us at files@mathworks.com