diff --git a/matlab/gdat_plot.m b/matlab/gdat_plot.m index d2a1edeb49a5d93db3dc6bc519a93d9c05180bde..ccbf80d03b49bead91fae55fdf1432a7e4941c77 100644 --- a/matlab/gdat_plot.m +++ b/matlab/gdat_plot.m @@ -38,6 +38,7 @@ elseif isfield(gdat_data,'gdat_params') && isfield(gdat_data.gdat_params,'doplot end if doplot==0; return; end redo_legend_from_Tags = 0; +do_legend = 1; if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(gdat_data.t) fighandle = get(0,'CurrentFigure'); @@ -63,6 +64,7 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty( eval(['linehandles{end+1} = plot(gdat_data.eqdsk' endstr '.rlim,gdat_data.eqdsk' endstr '.zlim,''k'');']) axis equal; title(eval(['gdat_data.eqdsk' endstr '.stitle'])); + do_legend = 0; elseif any(find(size(gdat_data.data)==length(gdat_data.t))) try if length(size(gdat_data.data))<=2 @@ -154,8 +156,10 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty( zoom on; end maxnblines = 1; - if redo_legend_from_Tags || any(strcmp(gdat_data.gdat_params.data_request,'powers')) || (numel(ab)==numel(gdat_data.label) && numel(ab)>1) - % keep legend from label + if ~exist('ab','var'), ab=get(gca,'children'); end + if do_legend==0 || redo_legend_from_Tags || any(strcmp(gdat_data.gdat_params.data_request,'powers')) ... + || (numel(ab)==numel(gdat_data.label) && numel(ab)>1) + % keep legend as is else for i=1:numel(linehandles) maxnblines = max(maxnblines,numel(linehandles{i})); @@ -168,7 +172,7 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty( end end end - if maxnblines==1; legend show; end + if do_legend==1 && maxnblines==1; legend show; end if strcmp(gdat_data.gdat_request,'mhd') % special case, add legend instead of ylabel delete(hylabel);