![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/674808/image.jpeg)
Align text of different entries in legend
14 次查看(过去 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!
0 个评论
采纳的回答
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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/674808/image.jpeg)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!