comparison Color.m @ 494:c6d03f951a7f feature/quantumTriangles

Meged with default
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 23 Feb 2017 09:32:30 +0100
parents 51d818bc8915
children 283bdea202d2
comparison
equal deleted inserted replaced
493:6b8297f66c91 494:c6d03f951a7f
7 green = [0.466 0.674 0.188]; 7 green = [0.466 0.674 0.188];
8 lightblue = [0.301 0.745 0.933]; 8 lightblue = [0.301 0.745 0.933];
9 darkred = [0.635 0.078 0.184]; 9 darkred = [0.635 0.078 0.184];
10 black = [0.000 0.000 0.000]; 10 black = [0.000 0.000 0.000];
11 white = [1.000 1.000 1.000]; 11 white = [1.000 1.000 1.000];
12 colors = { Color.blue, Color.red, Color.yellow, Color.green, Color.purple, Color.lightblue, Color.darkred, Color.black, Color.white};
12 end 13 end
13 14
14 methods(Static) 15 methods(Static)
15 function sample() 16 function sample()
16 markers ={'+', 'o', '*', '.', 'x', 'square', 'diamond', 'v', '^', '>', '<', 'pentagram', 'hexagram'}; 17 markers ={'+', 'o', '*', '.', 'x', 'square', 'diamond', 'v', '^', '>', '<', 'pentagram', 'hexagram'};
17 % Filled and non-filled markers? 18 % Filled and non-filled markers?
18 lineStyles = {'-', '--', ':', '-.'}; 19 lineStyles = {'-', '--', ':', '-.'};
19 colors = { Color.blue, Color.red, Color.yellow, Color.purple, Color.green, Color.lightblue, Color.darkred, Color.black, Color.white};
20 20
21 21
22 function showMarkers(x0, y0, lx, ly, color, filled) 22 function showMarkers(x0, y0, lx, ly, color, filled)
23 n = length(markers); 23 n = length(markers);
24 s = ceil(sqrt(n)); 24 s = ceil(sqrt(n));
39 end 39 end
40 end 40 end
41 end 41 end
42 42
43 function showColors(x0, y0, lx, ly) 43 function showColors(x0, y0, lx, ly)
44 n = length(colors); 44 n = length(Color.colors);
45 s = ceil(sqrt(n)); 45 s = ceil(sqrt(n));
46 46
47 x = linspace(x0, x0 + lx, s); 47 x = linspace(x0, x0 + lx, s);
48 y = linspace(y0, y0 + ly, s); 48 y = linspace(y0, y0 + ly, s);
49 49
50 [X,Y] = meshgrid(x,y); 50 [X,Y] = meshgrid(x,y);
51 51
52 for i = 1:n 52 for i = 1:n
53 lh = line(X(i),Y(i)); 53 lh = line(X(i),Y(i));
54 lh.Marker = 'o'; 54 lh.Marker = 'o';
55 lh.MarkerFaceColor = colors{i}; 55 lh.MarkerFaceColor = Color.colors{i};
56 lh.Color = colors{i}; 56 lh.Color = Color.colors{i};
57 lh.MarkerSize = 12; 57 lh.MarkerSize = 12;
58 end 58 end
59 end 59 end
60 60
61 function showLines(y0, ly, A, w) 61 function showLines(y0, ly, A, w)