Commit 4e85d3e7 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

minor fix of gdat_plot

parent 35439908
Pipeline #94754 passed with stages
in 3 minutes and 8 seconds
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment