Align text of different entries in legend

28 次查看(过去 30 天)
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!

采纳的回答

Scott MacKenzie
Scott MacKenzie 2021-7-5
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');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by