Text Boxes on MATLAB not showing up

10 ビュー (過去 30 日間)
Hans123
Hans123 2019 年 7 月 3 日
コメント済み: Star Strider 2019 年 7 月 3 日
The text boxes are not showing up for my plot, I am not getting an error message either. Let me know what is wrong in this code
clear, clc, close all
farsemi = zeros(1,1);
thirdsemi=zeros(1,1);
CH4_3 =[3.03,2.75,2.58,2.44,2.30,2.27,2.19,2.11,2.03,1.97,1.91,1.83,1.79,1.74,1.71,1.65,1.62,1.5,960e-3,726e-3,730e-3,775e-3,739e-3,787e-3];
Step_3 =[3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,81,111,141,171,201,231,261];
plot(Step_3,CH4_3,'-*','LineWidth',2)
index = (CH4_3 >= 1.5);
plot(Step_3,CH4_3,'b-*','LineWidth',2);
hold on
plot(Step_3(index), CH4_3(index), 'r-*','LineWidth',2);
semifar = CH4_3(end);
far=CH4_3(CH4_3>1.4 & CH4_3<1.6);
third=CH4_3(end-1);
farsemi = (far-semifar)./semifar;
thirdsemi = (third-semifar)./third;
dim1=[0.15,0.2,1,1];
dim2=[0.8,0.2,1,1];
str1=sprintf('%.2f',farsemi);
annotation('textbox',dim1,'String',str1,'FitBoxToText','on','EdgeColor','b');
str2=sprintf('%.2f',thirdsemi);
annotation('textbox',dim2,'String',str2,'FitBoxToText','on','EdgeColor','r');

採用された回答

Star Strider
Star Strider 2019 年 7 月 3 日
The annotation object positioning convention remains something of a mystery to me.
So I have no idea why this works, it just does:
dim1=[0.15,0.2,0.1,0.1];
dim2=[0.8,0.2,0.1,0.1];
Experiment to get the result you want!
  2 件のコメント
Hans123
Hans123 2019 年 7 月 3 日
Star Strider, you are a blessing to all of us in this forum.
Thanks again!
Star Strider
Star Strider 2019 年 7 月 3 日
As always, my pleasure!
I very much appreciate your compliment!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by