Changeset 717 for trunk/src


Ignore:
Timestamp:
Feb 25, 2014, 11:28:14 PM (11 years ago)
Author:
sommeria
Message:

export figure from view_field on existing axis

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r714 r717  
    45844584h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
    45854585if ~isempty(h)
    4586 map=colormap(handles.PlotAxes);
    4587 colormap(map);%transmit the current colormap to the zoom fig
    4588 colorbar
     4586    map=colormap(handles.PlotAxes);
     4587    colormap(map);%transmit the current colormap to the zoom fig
     4588    colorbar
    45894589end
    45904590
  • trunk/src/view_field.m

    r690 r717  
    119119%% reset position of text_display and TableDisplay
    120120% reset position of text_display
    121     pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
    122     pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
    123     pos_1(2)=size_fig(4)-pos_1(4);             % set text display to the top of the fig
    124     set(handles.text_display,'Position',pos_1)
    125     % reset position of TableDisplay
    126 %     pos_1=get(handles.TableDisplay,'Position');
    127 %     pos_1(1)=size_fig(3)-pos_1(3);
    128 %     pos_1(2)=size_fig(4)-pos_1(4);
    129     set(handles.TableDisplay,'Position',pos_1)
    130 % end
     121pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
     122pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
     123pos_1(2)=size_fig(4)-pos_1(4);             % set text display to the top of the fig
     124set(handles.text_display,'Position',pos_1)
     125% reset position of TableDisplay
     126set(handles.TableDisplay,'Position',pos_1)
    131127% reset position of CheckTable
    132128pos_CheckTable=get(handles.CheckTable,'Position');% [lower x lower y width height] for CheckHold
     
    168164
    169165%% reset position and scale of axis
     166set(handles.PlotAxes,'Units','pixels')
    170167bord=[50 40 30 60]; %bordure left,inf, right,sup
    171168pos(1)=bord(1);
     
    174171pos(4)=max(1,size_fig(4)-bord(4));
    175172set(handles.PlotAxes,'Position',pos)
     173set(handles.PlotAxes,'Units','normalized')
    176174
    177175%------------------------------------------------------------------------
     
    317315function MenuExportFigure_Callback(hObject, eventdata, handles)
    318316%-------------------------------------------------------------------
    319 huvmat=get(handles.MenuExport,'parent');
    320 UvData=get(huvmat,'UserData');
    321317hfig=figure;
    322 newaxes=copyobj(handles.PlotAxes,hfig);
    323 map=colormap(handles.PlotAxes);
    324 colormap(map);%transmit the current colormap to the zoom fig
    325 colorbar
     318copyobj(handles.PlotAxes,hfig);
     319if ~isempty(h)
     320    h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
     321    map=colormap(handles.PlotAxes);
     322    colormap(map);%transmit the current colormap to the zoom fig
     323    colorbar
     324end
     325
     326% --------------------------------------------------------------------
     327function MenuExportAxis_Callback(hObject, eventdata, handles)
     328ListFig=findobj(allchild(0),'Type','figure');
     329nb_option=0;
     330menu={};
     331for ilist=1:numel(ListFig)
     332    FigName=get(ListFig(ilist),'name');
     333    if isempty(FigName)
     334        FigName=['figure ' num2str(ListFig(ilist))];
     335    end
     336    if ~strcmp(FigName,'uvmat')
     337        ListAxes=findobj(ListFig(ilist),'Type','axes');
     338        ListTags=get(ListAxes,'Tag');
     339        if ~isempty(ListTags) && ~isempty(find(~strcmp('Colorbar',ListTags), 1))
     340            ListAxes=ListAxes(~strcmp('Colorbar',ListTags));
     341            if numel(ListAxes)==1
     342                nb_option=nb_option+1;
     343                menu{nb_option}=FigName ;
     344                AxesHandle(nb_option)=ListAxes;
     345            else
     346                nb_axis=0;
     347                for iaxes=1:numel(ListAxes)
     348                    nb_axis=nb_axis+1;
     349                    nb_option=nb_option+1;
     350                    menu{nb_option}=[FigName '_' num2str(nb_axis)];
     351                    AxesHandle(nb_option)=ListAxes(nb_axis);
     352                end
     353            end
     354        end
     355    end
     356end
     357if isempty(menu)
     358    answer=msgbox_uvmat('INPUT_Y-N','no existing plotting axes available, create new figure?');
     359    if strcmp(answer,'Yes')
     360        hfig=figure;
     361        copyobj(handles.PlotAxes,hfig);
     362    else
     363        return
     364    end
     365    map=colormap(handles.PlotAxes);
     366    colormap(map);%transmit the current colormap to the zoom fig
     367    colorbar
     368else
     369    answer=msgbox_uvmat('INPUT_MENU','select a figure/axis on which the current uvmat plot will be exported',menu);
     370    if isempty(answer)
     371        return
     372    else
     373        axes(AxesHandle(answer))
     374        hold on
     375        hchild=get(handles.PlotAxes,'children');
     376        copyobj(hchild,gca);
     377    end
     378end
    326379
    327380%-------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.