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 <noreply@anthropic.com>
This commit is contained in:
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
@@ -46,27 +46,17 @@ set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.2 0.30 0.60 0.60], ...
|
|||||||
xticklabels('auto')
|
xticklabels('auto')
|
||||||
set(gca, 'XTickLabelRotation', 0); % keep x labels horizontal (no auto-rotate)
|
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
|
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);
|
||||||
yl = ylim(gca);
|
if strcmp(metric, 'count') % count: tick every 5, label only every 10
|
||||||
yt = floor(yl(1) / 5) * 5 : 5 : ceil(yl(2) / 5) * 5;
|
yt = 0 : 5 : ceil(yl(2) / 5) * 5;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(yt);
|
||||||
for k = 1:numel(yt)
|
lab(mod(yt, 10) ~= 0) = "";
|
||||||
if mod(yt(k), 10) == 0; lbl{k} = num2str(yt(k)); else; lbl{k} = ''; end
|
|
||||||
end
|
|
||||||
set(gca, 'YTick', yt, 'YTickLabel', lbl);
|
|
||||||
else % rate: tick every 0.02, label only every 0.1
|
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;
|
yt = 0 : 0.02 : ceil(yl(2) / 0.02) * 0.02;
|
||||||
lbl = cell(1, numel(yt));
|
lab = string(round(yt, 1));
|
||||||
for k = 1:numel(yt)
|
lab(mod(round(yt * 100), 10) ~= 0) = "";
|
||||||
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);
|
|
||||||
end
|
end
|
||||||
|
yticks(yt); yticklabels(lab);
|
||||||
grid on % gridlines fall on the ticks (rate: every 0.02)
|
grid on % gridlines fall on the ticks (rate: every 0.02)
|
||||||
% Add breathing room between the y-axis label and the tick numbers.
|
% Add breathing room between the y-axis label and the tick numbers.
|
||||||
set(ylh, 'Units', 'normalized');
|
set(ylh, 'Units', 'normalized');
|
||||||
|
|||||||
Reference in New Issue
Block a user