How to use LaTeX interpreter for aligning words within an xlabel for a tilelayout?

3 views (last 30 days)
f = figure();
t = tiledlayout( 3, 1 );
a = gobjects( 3, 1 );
for idx = 1:3
% Plot some stuff in each subplot tile.
a( idx ) = nexttile( idx );
% Give each their own unique xlabels.
xlabel( gca, ['xlabel for axis: ', num2str( idx )] );
title( t, '\underline{title using latex formatting}', 'Interpreter', 'Latex' );
ylabel( t, 'A Y-Label that applies to all of my tiles', 'Interpreter', 'Latex' );
xlabel( t, 'Left Text\qquad{}\qquad{}\qquad{}Center Text\qquad{}\qquad{}\qquad{}Right Text', 'Interpreter', 'Latex'); % Ad-hoc, not standardized.
Is there a better way to do this? Ideally, "Left Text" is fully left-justified, "Center Text" is centered, and "Right Text" is fully right-justified. There's likely a LaTeX package that does it, but I don't know what it is and I doubt that MATLAB has it imported.
  1 Comment
dpb on 10 Sep 2021
I dunno about "better", but probably easiest would be to just use text to place the xlabel text where you wish for each section.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by