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