Skip to content
Snippets Groups Projects
Commit 19904da4 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

fix legend to add on to linehandles if multiple shots

parent 77a983e1
No related branches found
No related tags found
1 merge request!153Add multi shot
...@@ -40,10 +40,12 @@ if doplot==0; return; end ...@@ -40,10 +40,12 @@ if doplot==0; return; end
redo_legend_from_Tags = 0; redo_legend_from_Tags = 0;
do_legend = 1; do_legend = 1;
nb_linehandles_current = numel(linehandles);
for ishot=1:numel(gdat_data) for ishot=1:numel(gdat_data)
nb_linehandles_prev = nb_linehandles_current;
if all(isfield(gdat_data(ishot),{'data','t'})) && ~isempty(gdat_data(ishot).data) && ~isempty(gdat_data(ishot).t) if all(isfield(gdat_data(ishot),{'data','t'})) && ~isempty(gdat_data(ishot).data) && ~isempty(gdat_data(ishot).t)
fighandle = get(0,'CurrentFigure'); fighandle = get(0,'CurrentFigure');
if numel(gdat_data) > 1 && gdat_data(1).gdat_params.doplot==1 if ishot > 1 && gdat_data(1).gdat_params.doplot==1
% assume that for a series of shot, need doplot=-1 after 1st plot if doplot was 1 in request % assume that for a series of shot, need doplot=-1 after 1st plot if doplot was 1 in request
doplot = -1; doplot = -1;
end end
...@@ -161,12 +163,13 @@ for ishot=1:numel(gdat_data) ...@@ -161,12 +163,13 @@ for ishot=1:numel(gdat_data)
zoom on; zoom on;
end end
maxnblines = 1; maxnblines = 1;
nb_linehandles_current = numel(linehandles);
if ~exist('ab','var'), ab=get(gca,'children'); end if ~exist('ab','var'), ab=get(gca,'children'); end
if do_legend==0 || redo_legend_from_Tags || any(strcmp(gdat_data(ishot).gdat_params.data_request,'powers')) ... if do_legend==0 || redo_legend_from_Tags || any(strcmp(gdat_data(ishot).gdat_params.data_request,'powers')) ...
|| (numel(ab)==numel(gdat_data(ishot).label) && numel(ab)>1) || (numel(ab)==numel(gdat_data(ishot).label) && numel(ab)>1)
% keep legend as is % keep legend as is
else else
for i=1:numel(linehandles) for i=nb_linehandles_prev+1:nb_linehandles_current
maxnblines = max(maxnblines,numel(linehandles{i})); maxnblines = max(maxnblines,numel(linehandles{i}));
if numel(linehandles{i}) == 1 if numel(linehandles{i}) == 1
set(linehandles{i},'DisplayName',[num2str(gdat_data(ishot).shot)]); set(linehandles{i},'DisplayName',[num2str(gdat_data(ishot).shot)]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment