writing “latex command” in the Matlab figure comment

旧城冷巷雨未停 提交于 2019-12-08 06:51:18

问题


I have a figure in Matlab, inside the figure i would like to write comments on the figure. the comment include latex formula; for example, I want to write this comment on my figure $$ \vec{R} = 2 $$

here is an example that I found when I searched;

clear all;
close all;
clc;
figure
ms = 8;
fontSize = 18;
xx = 0:.1:1;
plot(xx,sin(xx))
xlabel('P_{fa}', 'fontsize', fontSize);
ylabel('P_{m}', 'fontsize', fontSize);

I want it looks like as in the attached figure below:

Note: I searched in last questions that already answered, I found that I can write latex commands in the legend, title, axis ... but not when writing comments inside the figure.


回答1:


Very easy: just add a text object with its 'interpreter' property set to 'latex':

text(.3, .5, '$\vec R=2$', 'interpreter', 'latex', 'fontsize', fontSize)

The first two arguments of text are coordinates; change them as needed.



来源:https://stackoverflow.com/questions/28928295/writing-latex-command-in-the-matlab-figure-comment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!