
%  For Matlab  7.14
%% Beschriftung von Stem und Scatter Plots

%% Daten

a = linspace(0.5,9.5,12);

b = rand(size(a));

%% Scatter Plot

figure(1);
scatter(a,b,'filled');

%% Text oberhalb
ht = text(a,b+0.02,num2str(b','%4.2f'));
set(ht,'HorizontalAlignment','center');
set(ht,'VerticalAlignment','bottom');

%% Stem Plot
figure(2);
stem(a,b);

%% Text rechts daneben
ht = text(a+0.2,b,num2str(b','%4.2f'));
set(ht,'VerticalAlignment','middle');

%% Noch 'n Plot
figure(3);
stem(a,b,'filled');
set(gca,'Position',[0.1,0.1,0.4,0.8]);

%% Textbox daneben
htb = annotation('textbox',[0.52,0.1,0.45,0.8]);
s = strread('stemtext.m','%s','delimiter','\n');             % ''Textread'' läuft bei mir nicht

set(htb, 'String',s(1:23),'Backgroundcolor',[0.9,1,0.9],'Fontsize',8);
