Skip to content

Commit

Permalink
Added global font size setting for diagnostic plots
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmoosh committed Mar 14, 2024
1 parent 0550861 commit 8f16212
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 19 deletions.
4 changes: 2 additions & 2 deletions comparison/CompareNepModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ function CompareNepModels(LIVE_PLOTS, scName, SEQUENTIAL, coeffPath, figDir, fig
fig = figure('Visible', 'off', 'Name', windowName);
end
clf(); hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);

the = linspace(0,pi,19); ph = linspace(0,2*pi,37);
[the2D, ph2D] = meshgrid(the,ph);
Expand Down
4 changes: 2 additions & 2 deletions comparison/CompareSatModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function CompareSatModels(LIVE_PLOTS, LOAD_PDS_ASCII, yearRange, RELATIVE_t, REL
fig = figure('Visible', 'off', 'Name', windowName);
end
clf(); hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);

% Plot planet, pole, and rings for illustrative purposes
pbaspect([1 1 1]);
Expand Down
4 changes: 2 additions & 2 deletions comparison/CompareUraModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function CompareUraModels(LIVE_PLOTS, scName, SEQUENTIAL, coeffPath, figDir, fig
fig = figure('Visible', 'off', 'Name', windowName);
end
clf(); hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);

plot3(x,y,z, 'LineWidth', 1.5);
the = linspace(0,pi,50); ph = linspace(0,2*pi,100);
Expand Down
5 changes: 4 additions & 1 deletion functions/plotting/ApplyPlotDefaults.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function ApplyPlotDefaults(fig, interpreter, font)
function ApplyPlotDefaults(fig, interpreter, font, fontsize)
% Applies default settings to plot labels.
%
% Parameters
Expand All @@ -9,6 +9,8 @@ function ApplyPlotDefaults(fig, interpreter, font)
% The default interpreter to use for rendering text labels on plots.
% font : char, 1xD
% The default font to use for text labels on plots.
% fontsize : double
% The default font size in pt to use for text labels on plots.

% Part of the PlanetMag framework for evaluation and study of planetary magnetic fields.
% Created by Corey J. Cochrane and Marshall J. Styczinski
Expand All @@ -22,5 +24,6 @@ function ApplyPlotDefaults(fig, interpreter, font)
set(fig, 'defaultTextFontName', font);
set(fig, 'defaultAxesFontName', font);
set(fig, 'defaultLegendFontName', font);
set(gca, 'fontSize', fontsize);

end
11 changes: 6 additions & 5 deletions functions/plotting/PlotBandLsq.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ function PlotBandLsq(ets, t_h, r_km, theta, phi, xyz_km, BrSC, BthSC, BphiSC, sc

if isempty(jt_h); JUNOTOO=0; else; JUNOTOO=1; end

[MagModel, CsheetModel, MPmodel, magModelDescrip, ~] = GetModelOpts(parentName, opt, MPopt);
[MagModel, CsheetModel, MPmodel, magModelDescrip, fModel] = GetModelOpts(parentName, opt, ...
MPopt);
magPhase = 0;

Nmax = 10;
Expand Down Expand Up @@ -164,21 +165,21 @@ function PlotBandLsq(ets, t_h, r_km, theta, phi, xyz_km, BrSC, BthSC, BphiSC, sc
yInfo = [mathTxt 'B_r' nmTxt ' component (nT)'];
legendStrings = [string(magModelDescrip), string(scDataName)];
titleInfo = commonTitle;
fName = [char(scName) parentName 'BrComparison' magModelDescrip fEnd];
fName = [char(scName) parentName 'BrComparison' fModel fEnd];
PlotGeneric(xx, yy, legendStrings, windowName, titleInfo, xInfo, yInfo, fName, ...
figDir, figXtn, LIVE_PLOTS, figNumBase + 1);

windowName = [char(scName) 'Bth, ' orbStr ', ' magModelDescrip];
yy = [Bth; BthSC];
yInfo = [mathTxt 'B_\theta' nmTxt ' component (nT)'];
fName = [char(scName) parentName 'BthComparison' magModelDescrip fEnd];
fName = [char(scName) parentName 'BthComparison' fModel fEnd];
PlotGeneric(xx, yy, legendStrings, windowName, titleInfo, xInfo, yInfo, fName, ...
figDir, figXtn, LIVE_PLOTS, figNumBase + 2);

windowName = [char(scName) 'Bphi, ' orbStr ', ' magModelDescrip];
yy = [Bphi; BphiSC];
yInfo = [mathTxt 'B_\phi' nmTxt ' component (nT)'];
fName = [char(scName) parentName 'BphiComparison' magModelDescrip fEnd];
fName = [char(scName) parentName 'BphiComparison' fModel fEnd];
PlotGeneric(xx, yy, legendStrings, windowName, titleInfo, xInfo, yInfo, fName, ...
figDir, figXtn, LIVE_PLOTS, figNumBase + 3);

Expand All @@ -187,7 +188,7 @@ function PlotBandLsq(ets, t_h, r_km, theta, phi, xyz_km, BrSC, BthSC, BphiSC, sc
yInfo = 'Component difference (nT)';
legendStrings = [string([ mathTxt '\Delta B_r']), string([mathTxt '\Delta B_\theta']), ...
string([mathTxt '\Delta B_\phi'])];
fName = [char(scName) parentName 'DeltaBComparison' magModelDescrip fEnd];
fName = [char(scName) parentName 'DeltaBComparison' fModel fEnd];
PlotGeneric(xx, yy, legendStrings, windowName, titleInfo, xInfo, yInfo, fName, ...
figDir, figXtn, LIVE_PLOTS, figNumBase + 4);

Expand Down
4 changes: 2 additions & 2 deletions functions/plotting/PlotGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
fig = figure('Visible', 'off', 'Name', windowName);
end
hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);

yySize = size(yy);
nPlots = yySize(1);
Expand Down
4 changes: 2 additions & 2 deletions functions/plotting/PlotSpectrum.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function PlotSpectrum(moonName, LIVE_PLOTS, figNumber, dataDir, figDir, fPattern
fig = figure('Visible', 'off', 'Name', windowName);
end
hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);

plot(T_h, abs(B1vec1), 'Color', 'b');
plot(T_h, abs(B1vec2), 'Color', 'k');
Expand Down
8 changes: 7 additions & 1 deletion functions/plotting/SetPlotDefaults.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [interpreter, font] = SetPlotDefaults
function [interpreter, font, fontsize] = SetPlotDefaults
% Sets global Matlab plotting defaults, including some global font switches.
%
% Returns
Expand All @@ -7,6 +7,11 @@
% The default interpreter to use for rendering text labels on plots.
% font : char, 1xD
% The default font to use for text labels on plots.
% fontsize : double
% The default font size in pt to use for text labels on plots.
%
% Sets globals
% ------------
% nmTxt : char, 1xE (global)
% Font switch to use in LaTeX-formatted labels with "normal" text.
% bnmTxt : char, 1xF (global)
Expand All @@ -33,5 +38,6 @@

interpreter = 'tex';
font = 'Times';
fontsize = 16;

end
4 changes: 2 additions & 2 deletions publication/MakeHodograms.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
fig = figure('Visible', 'off', 'Name', windowName);
end
hold on;
[interpreter, font] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font);
[interpreter, font, fontsize] = SetPlotDefaults();
ApplyPlotDefaults(fig, interpreter, font, fontsize);
tiles = tiledlayout(1, nMoons, 'TileSpacing', 'tight', 'Padding', 'tight');

for i=1:nMoons
Expand Down

0 comments on commit 8f16212

Please sign in to comment.