Gregorius Edwadr
Gregorius Edwadr

Reputation: 399

Plot labels in matlab graphic

I want to make a graphic in Matlab. Let's say I have a set [1,3,5] for x and [0.2,0.4,0.5] for y. Is it possible to plot a graphic that has a label on it instead of just a point or line. For example, in coordinate x=1 and y=0.2 it is written "event1" and in coordinate x=3 and y=0.4 it is written "event2".

Upvotes: 1

Views: 70

Answers (1)

am304
am304

Reputation: 13886

Yes, you could do something like this:

x = [1 3 5];
y = [0.2 0.4 0.5]
my_str = {'event 1';'event 2';'event 3'};
figure
text(x,y,my_str);
axis([0.8*min(x) 1.2*max(x) 0.8*min(y) 1.2*max(y)])

Upvotes: 1

Related Questions