function ezaxes(command)
    %
    %   GUI input for axes
    %
    %   typing 'ezaxes' from the command line opens an
    %   interactive dialogue box, allowing the user to specify
    %   grids, axes size, fonts, scaling etc.
    %   using pulldown menus.
    %
    %
    %   Richard G. Cobb    3/96
    %   rcobb@afit.af.mil
    %

    if nargin < 1
        %
        figold=gcf;
        haold=gca;
        newfig=figure_w_normalized_uicontrolunits('Color',[0.9 0.9 0.9],'NumberTitle','off','Name',...
            'EZ AXES',...
            'NextPlot','new',...
            'Units','Normalized',...
            'Position',[.1 .1  .4 .3]);
        sfactor=1;
        axis(axis);
        axis off
        line([.52 .52],[-.2 1.2],'Color',[0 1 0],'LineWidth',3);
        uicontrol('Parent',newfig,...
            'style','pushbutton',...
            'string','Close',...
            'units','normalized',...
            'position',[.1 .85 .15 .1*sfactor],...
             'Callback','delete(gcf)');

        uicontrol('Parent',newfig,...
            'style','pushbutton',...
            'string','Refresh',...
            'units','normalized',...
            'position',[.3 .85 .15 .1*sfactor],...
             'Callback','ezarrow(98)');



        ui(1)=figold; bi(1)=haold;
        % Box Button
        ui(2)=0;
        bi(2) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.1 .7 .2 .1*sfactor],...
            'String','Boxed',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(2)');
        %% grid button
        ui(3)=0;
        bi(3) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.1 .55 .2 .1*sfactor],...
            'String','Grid',...
            'Visible','on',...
            'Value',1,...
            'Callback','ezaxes(3)');
        % axes menu
        T4=['Equal ';'Square';'Normal';'Image ';'On    ';'Off   '];
        ui(4) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.1 .4 .2 .1*sfactor],...
            'String',T4,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(24)');
        bi(4) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.1 .4 .2 .1*sfactor],...
            'String','Axes',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(4)');

        % Tick direction button
        ui(5)=0;
        bi(5) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.1 .25 .2 .1*sfactor],...
            'String','Tick Direction',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(5)');

        % Ticklength edit
        ui(6)=uicontrol('Style','edit','Units','Normalized',...
            'Position',[.1 .1 .2 .1*sfactor],...
            'String',' ',...
            'Visible','off',...
            'Value',0,...
            'Callback','ezaxes(26)');
        bi(6) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.1 .1 .2 .1*sfactor],...
            'String','Tick Length',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(6)');

        % grid line style menu
        T7=[' - ';' --';' : ';' -.'];
        ui(7) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.32 .7 .2 .1*sfactor],...
            'String',T7,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(27)');
        bi(7) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.32 .7 .2 .1*sfactor],...
            'String','GridLines',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(7)');

        % Font name menu
        T8=['Avant Garde           ';...
            'Bookman               ';...
            'Courier               ';...
            'Helvetica             ';...
            'Helvetica Narrow      ';...
            'New Century Schoolbook';...
            'Palatino              ';...
            'Symbol                ';...
            'Times                 ';...
            'Zapf Chancery         ';...
            'Zapf Dingbats         '];
        ui(8) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.32 .55 .2 .1*sfactor],...
            'String',T8,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(28)');
        bi(8) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.32 .55 .2 .1*sfactor],...
            'String','FontName',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(8)');

        % font size menu
        T9=['10';'12';'16';'20';'24';'30'];
        ui(9) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.32 .4 .2 .1*sfactor],...
            'String',T9,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(29)');
        bi(9) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.32 .4 .2 .1*sfactor],...
            'String','FontSize',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(9)');

        % font weight menu
        T10=['Normal ';...
            'Light  ';...
            'Demi   ';...
            'Bold   '];
        ui(10) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.32 .25 .2 .1*sfactor],...
            'String',T10,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(30)');
        bi(10) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.32 .25 .2 .1*sfactor],...
            'String','FontWeight',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(10)');

        % font angle menu
        T11=['Normal ';'Italic ';'Oblique'];
        ui(11) = uicontrol('Style','Popup','Units','Normalized',...
            'Position',[.32 .1 .2 .1*sfactor],...
            'String',T11,...
            'Visible','off',...
            'HorizontalAlignment', 'left',...
            'Callback','ezaxes(31)');
        bi(11) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.32 .1 .2 .1*sfactor],...
            'String','FontAngle',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(11)');


        %% direction button
        ui(12)=0;
        bi(12) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.8 .85 .05 .1*sfactor],...
            'String','X',...
            'Visible','on',...
            'Value',0,...
            'BackgroundColor',[ 0 0 0 ],...
            'ForegroundColor',[ 0 1 0 ],...
            'Callback','ezaxes(12)');
        %% flip button

        ui(13)=0;
        bi(13) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.55 .7 .1 .1*sfactor],...
            'String','Flip',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(13)');


        %% grid button
        ui(14)=0;
        bi(14) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.7 .7 .1 .1*sfactor],...
            'String','Grid',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(14)');

        %% scale button
        ui(15)=0;
        bi(15) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.85 .7 .1 .1*sfactor],...
            'String','Scale',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(15)');

        %% limits edit
        ui(16)=uicontrol('Style','edit','Units','Normalized',...
            'Position',[.55 .475 .44 .1*sfactor],...
            'String',vec2str(get(haold,'Xlim')),...
            'Visible','off',...
            'Value',0,...
            'Callback','ezaxes(36)');
        bi(16) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.55 .475 .2 .1*sfactor],...
            'String','Limits',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(16)');

        %% tick edits
        ui(17)=uicontrol('Style','edit','Units','Normalized',...
            'Position',[.55 .325 .44 .1*sfactor],...
            'String',vec2str(get(haold,'XTick')),...
            'Visible','off',...
            'Value',0,...
            'Callback','ezaxes(37)');
        bi(17) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.55 .325 .2 .1*sfactor],...
            'String','Ticks',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(17)');

        %% ticklabel edit
        ui(18)=uicontrol('Style','edit','Units','Normalized',...
            'Position',[.55 .175 .44 .1*sfactor],...
            'String',mat2str(get(haold,'XTickLabels')),...
            'Visible','off',...
            'Value',0,...
            'Callback','ezaxes(38)');
        bi(18) = uicontrol('Style','pushbutton','Units','Normalized',...
            'Position',[.55 .175 .2 .1*sfactor],...
            'String','Tick Labels',...
            'Visible','on',...
            'Value',0,...
            'Callback','ezaxes(18)');

        %%% text strings
        uicontrol(...
            'style','text',...
            'string','Direction:',...
            'units','normalized',...
            'HorizontalAlignment','Center',...
            'position',[.5 .85 .3 .1*sfactor],...
            'BackgroundColor',[ 0 0 0 ],...
            'ForegroundColor',[ 0 1 0 ]);


        set(newfig,'UserData',[ui' bi']);

    elseif command == 1

    elseif command == 2
        handles = get(gcf,'UserData');
        if strcmp(get(handles(1,2),'Box'),'off')
            set(handles(1,2),'Box','on')
        else
            set(handles(1,2),'Box','off')
        end
    elseif command == 3
        handles = get(gcf,'UserData');
        figure_w_normalized_uicontrolunits(handles(1,1))
        grid
    elseif command == 4
        handles = get(gcf,'UserData');
        set(handles(4,2),'Visible','off')
        set(handles(4,1),'Visible','on')
    elseif command == 24
        handles = get(gcf,'UserData');
        T4=['Equal ';'Square';'Normal';'Image ';'On    ';'Off   '];
        figure_w_normalized_uicontrolunits(handles(1,1))
        axis(deblank(lower(T4(get(handles(4,1),'Value'),:))))
        set(handles(4,2),'Visible','on')
        set(handles(4,1),'Visible','off')

    elseif command == 5
        handles = get(gcf,'UserData');
        if strcmp(get(handles(1,2),'TickDir'),'in')
            set(handles(1,2),'TickDir','out')
        else
            set(handles(1,2),'TickDir','in')
        end
    elseif command == 6
        handles = get(gcf,'UserData');
        set(handles(6,2),'Visible','off')
        set(handles(6,1),'String',vec2str(get(handles(1,2),'Ticklength')))
        set(handles(6,1),'Visible','on')
    elseif command == 26
        handles = get(gcf,'UserData');
        set(handles(1,2),'TickLength',eval(get(handles(6,1),'String')))
        set(handles(6,2),'Visible','on')
        set(handles(6,1),'Visible','off')
    elseif command == 7
        handles = get(gcf,'UserData');
        set(handles(7,2),'Visible','off')
        set(handles(7,1),'Visible','on')
    elseif command == 27
        handles = get(gcf,'UserData');
        T7=[' - ';' --';' : ';' -.'];
        set(handles(1,2),'GridLineStyle',T7(get(handles(7,1),'Value'),:))
        set(handles(7,2),'Visible','on')
        set(handles(7,1),'Visible','off')

    elseif command == 8
        handles = get(gcf,'UserData');
        set(handles(8,2),'Visible','off')
        set(handles(8,1),'Visible','on')
    elseif command == 28
        handles = get(gcf,'UserData');
        T8=['Avant Garde           ';...
            'Bookman               ';...
            'Courier               ';...
            'Helvetica             ';...
            'Helvetica Narrow      ';...
            'New Century Schoolbook';...
            'Palatino              ';...
            'Symbol                ';...
            'Times                 ';...
            'Zapf Chancery         ';...
            'Zapf Dingbats         '];
        set(handles(1,2),'FontName',deblank(T8(get(handles(8,1),'Value'),:)))
        set(handles(8,2),'Visible','on')
        set(handles(8,1),'Visible','off')


    elseif command == 9
        handles = get(gcf,'UserData');
        set(handles(9,2),'Visible','off')
        set(handles(9,1),'Visible','on')
    elseif command == 29
        T9=['10';'12';'16';'20';'24';'30'];
        handles = get(gcf,'UserData');
        set(handles(1,2),'FontSize',eval(T9(get(handles(9,1),'Value'),:)))
        set(handles(9,2),'Visible','on')
        set(handles(9,1),'Visible','off')

    elseif command == 10
        handles = get(gcf,'UserData');
        set(handles(10,2),'Visible','off')
        set(handles(10,1),'Visible','on')
    elseif command == 30
        T10=['Normal ';...
            'Light  ';...
            'Demi   ';...
            'Bold   '];
        handles = get(gcf,'UserData');
        set(handles(1,2),'FontWeight',deblank(T10(get(handles(10,1),'Value'),:)))
        set(handles(10,2),'Visible','on')
        set(handles(10,1),'Visible','off')

    elseif command == 11
        handles = get(gcf,'UserData');
        set(handles(11,2),'Visible','off')
        set(handles(11,1),'Visible','on')
    elseif command == 31
        T11=['Normal ';'Italic ';'Oblique'];
        handles = get(gcf,'UserData');
        set(handles(1,2),'FontAngle',deblank(T11(get(handles(11,1),'Value'),:)))
        set(handles(11,2),'Visible','on')
        set(handles(11,1),'Visible','off')

    elseif command == 12
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(12,2),'String','Y')
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(12,2),'String','Z')
        else
            set(handles(12,2),'String','X')
        end

    elseif command == 13
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            if strcmp(get(handles(1,2),'XDir'),'normal')
                set(handles(1,2),'XDir','reverse')
            else
                set(handles(1,2),'XDir','normal')
            end
        elseif strcmp(get(handles(12,2),'String'),'Y')
            if strcmp(get(handles(1,2),'YDir'),'normal')
                set(handles(1,2),'YDir','reverse')
            else
                set(handles(1,2),'YDir','normal')
            end
        else
            if strcmp(get(handles(1,2),'ZDir'),'normal')
                set(handles(1,2),'ZDir','reverse')
            else
                set(handles(1,2),'ZDir','normal')
            end
        end

    elseif command == 14
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            if strcmp(get(handles(1,2),'XGrid'),'on')
                set(handles(1,2),'XGrid','off')
            else
                set(handles(1,2),'XGrid','on')
            end
        elseif strcmp(get(handles(12,2),'String'),'Y')
            if strcmp(get(handles(1,2),'YGrid'),'on')
                set(handles(1,2),'YGrid','off')
            else
                set(handles(1,2),'YGrid','on')
            end

        else
            if strcmp(get(handles(1,2),'ZGrid'),'on')
                set(handles(1,2),'ZGrid','off')
            else
                set(handles(1,2),'ZGrid','on')
            end

        end
    elseif command == 15
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            if strcmp(get(handles(1,2),'XScale'),'linear')
                set(handles(1,2),'XScale','log')
            else
                set(handles(1,2),'XScale','linear')
            end
        elseif strcmp(get(handles(12,2),'String'),'Y')
            if strcmp(get(handles(1,2),'YScale'),'linear')
                set(handles(1,2),'YScale','log')
            else
                set(handles(1,2),'YScale','linear')
            end

        else
            if strcmp(get(handles(1,2),'ZScale'),'linear')
                set(handles(1,2),'ZScale','log')
            else
                set(handles(1,2),'ZScale','linear')
            end
        end
    elseif command == 16
        handles = get(gcf,'UserData');
        set(handles(16,2),'Visible','off')
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(16,1),'String',vec2str(get(handles(1,2),'Xlim')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(16,1),'String',vec2str(get(handles(1,2),'Ylim')))
        else
            set(handles(16,1),'String',vec2str(get(handles(1,2),'Zlim')))
        end
        set(handles(16,1),'Visible','on')
    elseif command == 36
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(1,2),'Xlim',eval(get(handles(16,1),'String')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(1,2),'Ylim',eval(get(handles(16,1),'String')))
        else
            set(handles(1,2),'Zlim',eval(get(handles(16,1),'String')))
        end

        set(handles(16,2),'Visible','on')
        set(handles(16,1),'Visible','off')


    elseif command == 17
        handles = get(gcf,'UserData');
        set(handles(17,2),'Visible','off')
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(17,1),'String',vec2str(get(handles(1,2),'XTick')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(17,1),'String',vec2str(get(handles(1,2),'YTick')))
        else
            set(handles(17,1),'String',vec2str(get(handles(1,2),'ZTick')))
        end
        set(handles(17,1),'Visible','on')
    elseif command == 37
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(1,2),'XTick',eval(get(handles(17,1),'String')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(1,2),'YTick',eval(get(handles(17,1),'String')))
        else
            set(handles(1,2),'ZTick',eval(get(handles(17,1),'String')))
        end

        set(handles(17,2),'Visible','on')
        set(handles(17,1),'Visible','off')

    elseif command == 18
        handles = get(gcf,'UserData');
        set(handles(18,2),'Visible','off')
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(18,1),'String',ms2strv(get(handles(1,2),'XTickLabels')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(18,1),'String',ms2strv(get(handles(1,2),'YTickLabels')))
        else
            set(handles(18,1),'String',ms2strv(get(handles(1,2),'ZTickLabels')))
        end
        set(handles(18,1),'Visible','on')
    elseif command == 38
        handles = get(gcf,'UserData');
        if strcmp(get(handles(12,2),'String'),'X')
            set(handles(1,2),'XTickLabels',ms2strv(get(handles(18,1),'String')))
        elseif strcmp(get(handles(12,2),'String'),'Y')
            set(handles(1,2),'YTickLabels',ms2strv(get(handles(18,1),'String')))
        else
            set(handles(1,2),'ZTickLabels',ms2strv(get(handles(18,1),'String')))
        end

        set(handles(18,2),'Visible','on')
        set(handles(18,1),'Visible','off')


    elseif command == 19


    elseif command == 20
    elseif command == 98
        handles = get(gcf,'UserData');
        figure_w_normalized_uicontrolunits(handles(1,1))
        refresh
    elseif command == 99
    end
