How to display a number in a scientific notation in the plot?
6 次查看(过去 30 天)
显示 更早的评论
The code is below:
n=1000;
text(0.82,0.96, "$N =\mbox{ } $" +num2str(n), 'interpreter', 'latex', 'FontSize', 38) ;
I want that, "N =10^3" be displayed and not "N = 1000".
8 个评论
Walter Roberson
2022-1-14
The problem is your \mbox .
n = 1000;
text(0.82,0.96, sprintf("$N ={10}^{%d}$", log10(n)), 'interpreter', 'latex', 'FontSize', 18) ;
The support TeX markup is shown at https://www.mathworks.com/help/matlab/ref/matlab.graphics.primitive.text-properties.html#budt_bq-1_sep_shared-Interpreter . Unfortunately I do not see a list of supported latex markup.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!