Align text of different entries in legend

20 visualizzazioni (ultimi 30 giorni)
How can I align the text of different entries in the legend, e.g. align it with respect to the dot ?
legend('h=1.5m','h=10.5m','h=100.5m')
Thanks a lot!

Risposta accettata

Scott MacKenzie
Scott MacKenzie il 5 Lug 2021
A simple solution is to use a sans serif font, such as courier, and pad with spaces:
% test data
d = rand(3,5);
bar(d');
labels = { ' h=1.5 m',' h=10.5 m','h=100.5 m' };
h = legend(labels, 'fontname', 'courier', 'fontweight', 'b');

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by