Text Boxes on MATLAB not showing up

8 visualizaciones (últimos 30 días)
Hans123
Hans123 el 3 de Jul. de 2019
Comentada: Star Strider el 3 de Jul. de 2019
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');

Respuesta aceptada

Star Strider
Star Strider el 3 de Jul. de 2019
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 comentarios
Hans123
Hans123 el 3 de Jul. de 2019
Star Strider, you are a blessing to all of us in this forum.
Thanks again!
Star Strider
Star Strider el 3 de Jul. de 2019
As always, my pleasure!
I very much appreciate your compliment!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by