Text Boxes on MATLAB not showing up
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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');
0 comentarios
Respuesta aceptada
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!