From 8f8fc98d6a36f6547ebd35b9668323e5638dfea1 Mon Sep 17 00:00:00 2001 From: Experiments DB Dev Date: Fri, 24 Jul 2026 09:23:16 -0400 Subject: [PATCH] fix(matlab): actually make x-axis labels vertical (manual rotated text) exportgraphics on headless invisible figures ignores XTickLabelRotation/ xtickangle, so the labels stayed horizontal. Draw the tick labels as rotated text objects (Rotation 90) instead, add bottom margin, and drop the 'training day' axis label below them. Regenerated all learning-curve figures. Co-Authored-By: Claude Opus 4.8 --- analysis/matlab/variation_plot.m | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/analysis/matlab/variation_plot.m b/analysis/matlab/variation_plot.m index 8fb7f44..8399de2 100644 --- a/analysis/matlab/variation_plot.m +++ b/analysis/matlab/variation_plot.m @@ -38,9 +38,22 @@ legend([e1 e2], {sprintf('anodal, N = %d', na), sprintf('control, N = %d', nc)}, 'Location', 'northwest', 'Box', 'off'); xlabel('training day'); ylabel(ylab); title(vname, 'Interpreter', 'none'); -set(gca, 'XTick', xd, 'XTickLabelRotation', 90, ... % vertical x-axis tick labels +% Vertical x-axis tick labels. XTickLabelRotation / xtickangle are NOT honored +% by exportgraphics on a headless invisible figure, so draw the labels manually +% as rotated text objects (which always render). +set(gca, 'XTick', xd, 'XTickLabel', {}, 'Position', [0.13 0.20 0.80 0.70], ... 'FontName', 'Arial', 'FontSize', 13, 'LineWidth', 1.5, 'Box', 'off'); -drawnow; % force layout so the rotation is applied headless +drawnow; +yl = ylim(gca); +yb = yl(1) - 0.015 * (yl(2) - yl(1)); +for k = 1:numel(xd) + text(xd(k), yb, num2str(xd(k)), 'Parent', gca, 'Rotation', 90, ... + 'HorizontalAlignment', 'right', 'VerticalAlignment', 'middle', ... + 'FontName', 'Arial', 'FontSize', 13, 'Clipping', 'off'); +end +xlh = get(gca, 'XLabel'); % push the axis label below the vertical ticks +set(xlh, 'Units', 'normalized', 'Position', [0.5 -0.15 0]); +drawnow; exportgraphics(fig, outFile, 'Resolution', 150); close(fig); fprintf('%s: wrote %s (anodal N=%d, control N=%d)\n', vname, outFile, na, nc);