Home > front end >  How add annotation to semilogx in Matlab?
How add annotation to semilogx in Matlab?

Time:09-22

I would like to add desciption on the curves in Matlab using annotation, but I always see the below error

Error using annotation
Unknown argument.

Error in del (line 5)
annotation('textarrow',Q,y,'String','y = x ')

May I get some assistance, please? Doesn't annotation work with semilogx?

Q = [16,32,64,128,256,512,1024];
y = [9     9     9     9     5     0     0]*0.25;
y1 = [45    37    25    21     5     0     0]*0.25;
semilogx(Q,y,Q,y1)
annotation('textarrow',Q,y,'String','\theta =0 ')
annotation('textarrow',Q,y1,'String','\theta = 10 ')
xlabel('Q oder');
ylabel('Coverage area m^2');
grid on;

CodePudding user response:

annotation creates a line between two points.

The input to annotation must be on the format

x = [0.3 0.5];
y = [0.6 0.5];
annotation('textarrow',x,y,'String','\theta =0 ')

where x and y are selected by you. This is typically a bit of trial and error to make it look nice.

  • Related