This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
draw2DPoints.m
50 lines (44 loc) · 1.49 KB
/
draw2DPoints.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%Simply draws / plots the points in 2D
%
%Author: Christian Wengert,
% Institute of Computer Vision
% Swiss Federale Institute of Technology, Zurich (ETHZ)
% wengert@vision.ee.ethz.ch
% www.vision.ee.ethz.ch/~cwengert/
%
%Input: x The 2D points to draw
% name Specifiy a title for your plot
% numbers 1 if you want to have the point numbers on the plot, 0 otherwise (default)
% handle A handle to a figure
%
%Syntax: draw3DPoints(x, name, numbers, handle)
function draw2DPoints(x, name, numbers, handle, color)
if (nargin<1 | nargin>5)
error('draw2DPoints::Syntax: draw2DPoints(X, name, numbers, handle,color)');
end
%Check for default
if(nargin<5)
color = 'r+';
if(nargin<=4)
figure(handle)
if(nargin<3)
numbers=0;
if(nargin<2)
name = '';
end
end
end
end
% plot(x(1,1),x(2,1),'kd'), hold on
plot(x(1,1),x(2,1),color), hold on
plot(x(1,2:end),x(2,2:end),color), grid on, title('3D'),axis on,xlabel('x'),ylabel('y')
grid on
title(name)
xlabel('x')
ylabel('y')
%Draw point numbers
if(numbers)
hold on
drawPointNumbers(x)
hold off
end