Skip to content

Commit

Permalink
tsEvaPlotGEVImageSc, tsEvaPlotReturnLevelsGEV: modified in order to w…
Browse files Browse the repository at this point in the history
…ork on request on an axis handle
  • Loading branch information
Lorenzo Mentaschi authored and Lorenzo Mentaschi committed Jul 25, 2016
1 parent 6282602 commit e120100
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
24 changes: 18 additions & 6 deletions tsEvaPlotGEVImageSc.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
args.axisFontSize = 22;
args.labelFontSize = 28;
args.colormap = flipud(hot(64));
args.plotColorbar = true;
args.figPosition = [0, 0, 1450, 700] + 10;
args.xtick = [];
args.ax = [];
args = tsEasyParseNamedArgs(varargin, args);

minTS = datenum([args.minYear, 1, 1]);
Expand All @@ -19,9 +21,15 @@
mu = mu( (timeStamps >= minTS) & (timeStamps <= maxTS) );
timeStamps = timeStamps( (timeStamps >= minTS) & (timeStamps <= maxTS) );

f = figure;
phandles{1} = f;
f.Position = args.figPosition;
if isempty(args.ax)
f = figure;
phandles{1} = f;
f.Position = args.figPosition;
else
axes(args.ax);
phandles{1} = args.ax;
f = [];
end

L = length(timeStamps);
minTS = timeStamps(1);
Expand Down Expand Up @@ -66,13 +74,17 @@
end
xlim([min(timeStamps_plot) max(timeStamps_plot)]);
grid on;
clb = colorbar;
ylabel(clb, args.zlabel, 'fontsize', args.labelFontSize);
if args.plotColorbar
clb = colorbar;
ylabel(clb, args.zlabel, 'fontsize', args.labelFontSize);
end

ylabel(args.ylabel, 'fontsize', args.labelFontSize);

set(gca, 'fontsize', args.axisFontSize);

set(f, 'paperpositionmode', 'auto');
if ~isempty(f)
set(f, 'paperpositionmode', 'auto');
end
end

18 changes: 14 additions & 4 deletions tsEvaPlotReturnLevelsGEV.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
args.ylabel = 'return levels (m)';
args.ylim = [];
args.dtSampleYears = 1; % one year
args.ax = [];
args = tsEasyParseNamedArgs(varargin, args);
minReturnPeriodYears = args.minReturnPeriodYears;
maxReturnPeriodYears = args.maxReturnPeriodYears;
Expand All @@ -29,9 +30,16 @@
minRL = min(infRLCI);
end

f = figure;
phandles{1} = f;
f.Position = [0, 0, 1300, 700] + 10;
if isempty(args.ax)
f = figure;
phandles{1} = f;
f.Position = [0, 0, 1300, 700] + 10;
else
axes(args.ax);
phandles{1} = args.ax;
f = [];
end

h = area(returnPeriodsInYears, cat(1, infRLCI, supRLCI - infRLCI)', 'linestyle', 'none');
h(1).FaceColor = [1,1,1];
h(2).FaceColor = args.confidenceAreaColor;
Expand All @@ -54,7 +62,9 @@
xlabel(args.xlabel, 'fontsize', 24);
ylabel(args.ylabel, 'fontsize', 24);

set(f, 'paperpositionmode', 'auto');
if ~isempty(f)
set(f, 'paperpositionmode', 'auto');
end

end

0 comments on commit e120100

Please sign in to comment.