Is it possible to get a reduced space character in a text?
17 次查看(过去 30 天)
显示 更早的评论
How can I change the full size of the space character to half in a legend? I need it in between numbers and a unit. For example after the number 1: t=1 s.
0 个评论
回答(1 个)
Walter Roberson
2017-10-23
thin = char(8201); %https://en.wikipedia.org/wiki/Thin_space
phrase = sprintf('The event lasted %.3f%ss', pi, thin);
plot(1:10);
legend(phrase)
4 个评论
Walter Roberson
2017-10-23
编辑:Walter Roberson
2017-10-23
I just tested R2017a on Mac OS-X (El Capitan); I cannot be sure that the space was thin, but I saw no black line.
You could also experiment with char(8239), the non-breaking thin space.
Another way:
phrase = sprintf('The event lasted %.3f\\,s', pi);
plot(1:10);
leg = legend(phrase);
leg.Interpreter = 'latex';
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!