-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmvnumplot.m
89 lines (77 loc) · 2.32 KB
/
mvnumplot.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function [] = mvnumplot(X,Y,color,startingnumber)
%MVNUMPLOT -- plot with numbers as plot symbols
%
% Usage:
% mvnumplot(X,Y[,color,startingnumber])
%
% Inputs:
% X vector, X-axis data
% Y vector, Y-axis data
% color string or 1-by-3 rgb color specification,
% 'white' or 'w', or 'many:' followed by a
% colormap name (e.g. 'many:hot')
% startingnumber integer, number of the first point
%
% Description:
% This function provides plotting with e.g object (row) numbers
% as plotting symbols.
%
% Side effects:
% To get proper scaling this function plots a black plot first,
% this will of course give you a problem when printing or
% displaying the figure with another background color,
% i.e. whitebg('white'). Also supports different color for
% each point. This option suffers from a serious MEMORY problem
% though. Avoid it by closing the figure window prior to
% plotting.
%
% Copying:
% MVARTOOLS, Copyright (C) 1999-2001 Rune Mathisen <[email protected]>
% MVARTOOLS comes with ABSOLUTELY NO WARRANTY; for details type
% `mvwarranty'. This is free software, and you are welcome to
% redistribute it under certain conditions; type `mvcopying' for
% details. For more information on MVARTOOLS, type 'mvreadme'.
% $Id: mvnumplot.m,v 1.3 2001/12/13 22:08:50 rune Exp $
% bad fix of strange bug...
[xr,xc]=size(X);
[yr,yc]=size(Y);
if xr<xc,
X = X'
end
if yr<yc,
Y = Y'
end
if nargin < 3
color = [];
end
if isempty(color)
co = get(0,'defaultaxescolororder');
color = co(1,:);
end
if nargin < 4
startingnumber = 1;
end
colorindex = ones(1,size(X,1));
if findstr(color,'many:')
colormap = color(6:length(color));
numcolors = 128;
colorcommand = ['color = ', colormap, '(numcolors);'];
eval(colorcommand)
colorindex = round(linspace(1,numcolors,size(X,1)));
end
plotcommand = plot(X,Y,'k.');
set(plotcommand,'markersize',1)
for i=1:size(X,1)
label = text( X(i), Y(i), int2str(i+startingnumber-1) );
set(label, ...
'FontSize',8, ...
'Color',color(colorindex(i),:), ...
'VerticalAlignment','middle', ...
'HorizontalAlignment','center')
end
% find max and min in plot
%maxx = max(X);
%minx = min(X);
%maxy = max(Y);
%miny = min(Y);
% end of mvnumplot