编写"latex command"在Matlab图中的注释 [英] writing "latex command" in the Matlab figure comment
问题描述
我在Matlab中有一个图形,在图形中我想在该图形上写注释. 评论包括乳胶配方;例如,我想在我的图形$$ \ vec {R} = 2 $$
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.
推荐答案
非常简单:只需添加 text
对象,其'interpreter'
属性设置为'latex'
:
Very easy: just add a text
object with its 'interpreter'
property set to 'latex'
:
text(.3, .5, '$\vec R=2$', 'interpreter', 'latex', 'fontsize', fontSize)
text
的前两个参数是坐标;根据需要更改它们.
The first two arguments of text
are coordinates; change them as needed.
这篇关于编写"latex command"在Matlab图中的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!