From 31b4d8744990d98b156625869b5c0cb29cfe77b2 Mon Sep 17 00:00:00 2001 From: Experiments DB Dev Date: Fri, 24 Jul 2026 10:49:49 -0400 Subject: [PATCH] refactor(matlab): simplify y-tick labels with yticks/yticklabels Replace set(gca,'YTick'/'YTickLabel') + for-loop with yticks()/yticklabels() and vectorized label-blanking (string array). Identical output (count: tick 5 label 10; rate: tick 0.02 label 0.1, grid every 0.02); PNGs unchanged. Co-Authored-By: Claude Opus 4.8 --- analysis/matlab/variation_plot.m | 26 ++++++------------- .../variations/boxa_a2_d0_10/plotcurve.m | 26 ++++++------------- .../variations/boxa_a2_d0_5/plotcurve.m | 26 ++++++------------- .../variations/boxa_a2_d6_10/plotcurve.m | 26 ++++++------------- .../variations/boxa_b2_d0_10/plotcurve.m | 26 ++++++------------- .../variations/boxa_b2_d0_5/plotcurve.m | 26 ++++++------------- .../variations/boxa_b2_d6_10/plotcurve.m | 26 ++++++------------- .../matched_current_d0_3/plotcurve.m | 26 ++++++------------- .../variations/naive_a2_d0_10/plotcurve.m | 26 ++++++------------- .../variations/naive_a2_d0_13/plotcurve.m | 26 ++++++------------- .../variations/naive_a2_d0_5/plotcurve.m | 26 ++++++------------- .../variations/naive_a2_d6_10/plotcurve.m | 26 ++++++------------- .../variations/naive_a2_d6_13/plotcurve.m | 26 ++++++------------- .../variations/naive_boxa_d0_10/plotcurve.m | 26 ++++++------------- .../variations/naive_boxa_d0_13/plotcurve.m | 26 ++++++------------- .../variations/naive_boxa_d0_5/plotcurve.m | 26 ++++++------------- .../variations/naive_boxa_d6_10/plotcurve.m | 26 ++++++------------- .../variations/naive_boxa_d6_13/plotcurve.m | 26 ++++++------------- .../matlab/variations/prev_f_full/plotcurve.m | 26 ++++++------------- .../variations/right_only_d0_10/plotcurve.m | 26 ++++++------------- .../variations/right_only_d0_13/plotcurve.m | 26 ++++++------------- .../variations/right_only_d0_5/plotcurve.m | 26 ++++++------------- .../variations/right_only_d6_10/plotcurve.m | 26 ++++++------------- .../variations/right_only_d6_13/plotcurve.m | 26 ++++++------------- .../variations/unmerge_d0_10/plotcurve.m | 26 ++++++------------- .../variations/unmerge_d0_13/plotcurve.m | 26 ++++++------------- .../variations/unmerge_d0_5/plotcurve.m | 26 ++++++------------- .../variations/unmerge_d6_10/plotcurve.m | 26 ++++++------------- .../variations/unmerge_d6_13/plotcurve.m | 26 ++++++------------- 29 files changed, 232 insertions(+), 522 deletions(-) diff --git a/analysis/matlab/variation_plot.m b/analysis/matlab/variation_plot.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variation_plot.m +++ b/analysis/matlab/variation_plot.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_a2_d0_10/plotcurve.m b/analysis/matlab/variations/boxa_a2_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_a2_d0_10/plotcurve.m +++ b/analysis/matlab/variations/boxa_a2_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_a2_d0_5/plotcurve.m b/analysis/matlab/variations/boxa_a2_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_a2_d0_5/plotcurve.m +++ b/analysis/matlab/variations/boxa_a2_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_a2_d6_10/plotcurve.m b/analysis/matlab/variations/boxa_a2_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_a2_d6_10/plotcurve.m +++ b/analysis/matlab/variations/boxa_a2_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_b2_d0_10/plotcurve.m b/analysis/matlab/variations/boxa_b2_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_b2_d0_10/plotcurve.m +++ b/analysis/matlab/variations/boxa_b2_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_b2_d0_5/plotcurve.m b/analysis/matlab/variations/boxa_b2_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_b2_d0_5/plotcurve.m +++ b/analysis/matlab/variations/boxa_b2_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/boxa_b2_d6_10/plotcurve.m b/analysis/matlab/variations/boxa_b2_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/boxa_b2_d6_10/plotcurve.m +++ b/analysis/matlab/variations/boxa_b2_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/matched_current_d0_3/plotcurve.m b/analysis/matlab/variations/matched_current_d0_3/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/matched_current_d0_3/plotcurve.m +++ b/analysis/matlab/variations/matched_current_d0_3/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_a2_d0_10/plotcurve.m b/analysis/matlab/variations/naive_a2_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_a2_d0_10/plotcurve.m +++ b/analysis/matlab/variations/naive_a2_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_a2_d0_13/plotcurve.m b/analysis/matlab/variations/naive_a2_d0_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_a2_d0_13/plotcurve.m +++ b/analysis/matlab/variations/naive_a2_d0_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_a2_d0_5/plotcurve.m b/analysis/matlab/variations/naive_a2_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_a2_d0_5/plotcurve.m +++ b/analysis/matlab/variations/naive_a2_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_a2_d6_10/plotcurve.m b/analysis/matlab/variations/naive_a2_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_a2_d6_10/plotcurve.m +++ b/analysis/matlab/variations/naive_a2_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_a2_d6_13/plotcurve.m b/analysis/matlab/variations/naive_a2_d6_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_a2_d6_13/plotcurve.m +++ b/analysis/matlab/variations/naive_a2_d6_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_boxa_d0_10/plotcurve.m b/analysis/matlab/variations/naive_boxa_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_boxa_d0_10/plotcurve.m +++ b/analysis/matlab/variations/naive_boxa_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_boxa_d0_13/plotcurve.m b/analysis/matlab/variations/naive_boxa_d0_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_boxa_d0_13/plotcurve.m +++ b/analysis/matlab/variations/naive_boxa_d0_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_boxa_d0_5/plotcurve.m b/analysis/matlab/variations/naive_boxa_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_boxa_d0_5/plotcurve.m +++ b/analysis/matlab/variations/naive_boxa_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_boxa_d6_10/plotcurve.m b/analysis/matlab/variations/naive_boxa_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_boxa_d6_10/plotcurve.m +++ b/analysis/matlab/variations/naive_boxa_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/naive_boxa_d6_13/plotcurve.m b/analysis/matlab/variations/naive_boxa_d6_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/naive_boxa_d6_13/plotcurve.m +++ b/analysis/matlab/variations/naive_boxa_d6_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/prev_f_full/plotcurve.m b/analysis/matlab/variations/prev_f_full/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/prev_f_full/plotcurve.m +++ b/analysis/matlab/variations/prev_f_full/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/right_only_d0_10/plotcurve.m b/analysis/matlab/variations/right_only_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/right_only_d0_10/plotcurve.m +++ b/analysis/matlab/variations/right_only_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/right_only_d0_13/plotcurve.m b/analysis/matlab/variations/right_only_d0_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/right_only_d0_13/plotcurve.m +++ b/analysis/matlab/variations/right_only_d0_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/right_only_d0_5/plotcurve.m b/analysis/matlab/variations/right_only_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/right_only_d0_5/plotcurve.m +++ b/analysis/matlab/variations/right_only_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/right_only_d6_10/plotcurve.m b/analysis/matlab/variations/right_only_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/right_only_d6_10/plotcurve.m +++ b/analysis/matlab/variations/right_only_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/right_only_d6_13/plotcurve.m b/analysis/matlab/variations/right_only_d6_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/right_only_d6_13/plotcurve.m +++ b/analysis/matlab/variations/right_only_d6_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/unmerge_d0_10/plotcurve.m b/analysis/matlab/variations/unmerge_d0_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/unmerge_d0_10/plotcurve.m +++ b/analysis/matlab/variations/unmerge_d0_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/unmerge_d0_13/plotcurve.m b/analysis/matlab/variations/unmerge_d0_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/unmerge_d0_13/plotcurve.m +++ b/analysis/matlab/variations/unmerge_d0_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/unmerge_d0_5/plotcurve.m b/analysis/matlab/variations/unmerge_d0_5/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/unmerge_d0_5/plotcurve.m +++ b/analysis/matlab/variations/unmerge_d0_5/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/unmerge_d6_10/plotcurve.m b/analysis/matlab/variations/unmerge_d6_10/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/unmerge_d6_10/plotcurve.m +++ b/analysis/matlab/variations/unmerge_d6_10/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized'); diff --git a/analysis/matlab/variations/unmerge_d6_13/plotcurve.m b/analysis/matlab/variations/unmerge_d6_13/plotcurve.m index adeedd6..14b424e 100644 --- a/analysis/matlab/variations/unmerge_d6_13/plotcurve.m +++ b/analysis/matlab/variations/unmerge_d6_13/plotcurve.m @@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ... xticklabels('auto') set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate) xlim([min(xd) - 0.5, max(xd) + 0.5]); % half-day padding so points aren't on the edges -if strcmp(metric, 'count') % count: tick every 5, but label only every 10 - yl = ylim(gca); - yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); +yl = ylim(gca); +if strcmp(metric, 'count') % count: tick every 5, label only every 10 + yt = 0 : 5 : ceil(yl(2) / 5) * 5; + lab = string(yt); + lab(mod(yt, 10) ~= 0) = ""; else % rate: tick every 0.02, label only every 0.1 - yl = ylim(gca); yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02; - lbl = cell(1, numel(yt)); - for k = 1:numel(yt) - if abs(yt(k) / 0.1 - round(yt(k) / 0.1)) < 1e-9 % multiple of 0.1 - lbl{k} = num2str(round(yt(k), 1)); - else - lbl{k} = ''; - end - end - set(gca, 'YTick', yt, 'YTickLabel', lbl); + lab = string(round(yt, 1)); + lab(mod(round(yt * 100), 10) ~= 0) = ""; end +yticks(yt); yticklabels(lab); grid on % gridlines fall on the ticks (rate: every 0.02) % Add breathing room between the y-axis label and the tick numbers. set(ylh, 'Units', 'normalized');