Skip to content

Commit

Permalink
Diagnostic scatter plots of 2D variables now have the figure backgrou…
Browse files Browse the repository at this point in the history
…nd set to white while the axis background is still light grey.
  • Loading branch information
ggalibert committed Apr 18, 2018
1 parent 68ac5a9 commit b07adfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Graph/pcolorMooring2DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)

initiateFigure = true;

backgroundColor = [0.85 0.85 0.85]; % light grey to allow for colorbar with white
backgroundFigure = [1 1 1]; % white
backgroundAxis = [0.85 0.85 0.85]; % light grey to allow for colorbar with white

for i=1:lenSampleData
% instrument description
Expand Down Expand Up @@ -146,7 +147,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'Color', backgroundFigure, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand Down Expand Up @@ -227,9 +228,8 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)

set(get(hCBar, 'Title'), 'String', [varName ' (' varUnit ')'], 'Interpreter', 'none');

% set axes background to be transparent (figure color shows
% through)
set(hAxMooringVar, 'Color', 'none')
% set axes background
set(hAxMooringVar, 'Color', backgroundAxis)
end
end
end
Expand All @@ -247,7 +247,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
fileName = strrep(fileName, '_PARAM_', ['_', varName, '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_PCOLOR_');

fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName));
fastSaveas(hFigMooringVar, backgroundFigure, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
Expand Down
18 changes: 8 additions & 10 deletions Graph/scatterMooring2DVarAgainstDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
end
end

backgroundColor = [0.85 0.85 0.85]; % light grey to allow for colorbar with white
backgroundFigure = [1 1 1]; % white
backgroundAxis = [0.85 0.85 0.85]; % light grey to allow for colorbar with white

if any(isPlottable)
% collect visualQC config
Expand Down Expand Up @@ -246,7 +247,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'Color', backgroundFigure, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand All @@ -260,7 +261,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
hold(hAxMooringVar, 'on');

% dummy entry for first entry in legend
hScatterVar(1) = plot(0, 0, 'Color', backgroundColor, 'Visible', 'off'); % color same as background (invisible in legend)
hScatterVar(1) = plot(0, 0, 'Color', backgroundAxis, 'Visible', 'off'); % color same as background (invisible in legend)

% set data cursor mode custom display
dcm_obj = datacursormode(hFigMooringVar);
Expand Down Expand Up @@ -403,9 +404,8 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
'YGrid', 'on', ...
'Layer', 'top');

% set axes background to be transparent (figure color shows
% through)
set(hAxMooringVar, 'Color', 'none')
% set axes background
set(hAxMooringVar, 'Color', backgroundAxis)
end

% we plot the instrument nominal depth
Expand Down Expand Up @@ -468,7 +468,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
end
end
posAx = get(hAxMooringVar, 'Position');
set(hLegend, 'Units', 'Normalized', 'Color', 'none')
set(hLegend, 'Units', 'Normalized', 'Color', backgroundAxis)
posLh = get(hLegend, 'Position');
if posLh(2) < 0
set(hLegend, 'Position',[posLh(1), abs(posLh(2)), posLh(3), posLh(4)]);
Expand All @@ -477,13 +477,11 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
set(hAxMooringVar, 'Position',[posAx(1), posAx(2)+abs(posLh(2)), posAx(3), posAx(4)-abs(posLh(2))]);
end

% set(hLegend, 'Box', 'off', 'Color', 'none');

if saveToFile
fileName = strrep(fileName, '_PARAM_', ['_', varName, '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_SCATTER_');

fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName));
fastSaveas(hFigMooringVar, backgroundFigure, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
Expand Down

0 comments on commit b07adfd

Please sign in to comment.