传说旁边的垂直线图

时间:2016-07-11 17:36:55

标签: matlab matlab-figure legend legend-properties

在Matlab中,可以为绘图创建图例。现在我不想要图例框中的信息,而是直接在该行的旁边,如下所示:

enter image description here

(这只是一个例子)

对于垂直线,我做了以下内容:

v1 = vline(14.7,'k')
set(v1,'Color','black','LineStyle','--','LineWidth',1);

如何在两条垂直线旁边添加信息(就像14.7s和18.6s一样),如图所示?

1 个答案:

答案 0 :(得分:3)

使用text功能,例如

figure();
v1 = vline([14.7, 18.6], 'k');
set(v1, 'Color', 'black', 'LineStyle', '--', 'LineWidth', 1);
xlim([8,25]);

text(14.8, 0.87,'\leftarrow 14.7 s');
text(18.7, 0.9,'\leftarrow 18.6 s');

enter image description here