Text Boxes on MATLAB not showing up

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by