Mercurial > repos > public > sbplib
comparison +draw/labelPoint.m @ 0:48b6fb693025
Initial commit.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Sep 2015 10:12:50 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:48b6fb693025 |
---|---|
1 % Takes a variable number of points as inputs and plots them with a label to the current figure. | |
2 % label_pt(p) | |
3 function label_pt(varargin) | |
4 for i = 1:length(varargin) | |
5 try | |
6 placelabel(varargin{i},inputname(i)); | |
7 catch e | |
8 error('Could not place label for input %d, ''%s''. Not a valid point',i,inputname(i)) | |
9 end | |
10 end | |
11 end | |
12 | |
13 function placelabel(pt,str) | |
14 x = pt(1); | |
15 y = pt(2); | |
16 h = line(x,y); | |
17 h.Marker = '.'; | |
18 h = text(x,y,str); | |
19 h.HorizontalAlignment = 'center'; | |
20 h.VerticalAlignment = 'bottom'; | |
21 end |