-
Notifications
You must be signed in to change notification settings - Fork 4
/
sample.m
136 lines (131 loc) · 4.11 KB
/
sample.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
clear;
for case_id = 14
switch case_id,
case 1,
col = colormap_CD([0.16 0.89;],[1 0.3],[0 0],12);
colormap_name = 'hot';
case 2,
col = colormap_CD([0.45 0.70; 0.25 0.9],[0.7 0.35],[0 0],6);
colormap_name = 'jet';
case 3,
col = colormap_CD([ 0.45 0.7; 0.08 0.95],[1 .35],[0 0],6);
colormap_name = 'b2r';
case 4,
col = colormap_CD([.96 .16],[.3 .8],[0 0],12);
colormap_name = 'autumn';
case 5,
col = colormap_CD([0 1/6 1/3 2/3 5/6 1]',[0.9 .35],[0 0 0 0 0 1],5);
colormap_name = 'detail';
case 6,
col = colormap_CD([ 0.45 0.7; 0.08 .95],[.95 .35],[1 0],8);
col = col([1:8 10:2:end],:);
colormap_name = 'k2r';
case 7,
col = g2rCD(6);
colormap_name = 'g2rCD';
case 8,
col = g2rCD(6,'s2g');
colormap_name = 'g2rCD_s2g';
case 9,
col = g2rCD(6,'g2b');
colormap_name = 'g2rCD_g2b';
case 10,
col = b2rCD(6);
colormap_name = 'b2rCD';
case 11,
col = b2rCD(6,'precip');
colormap_name = 'b2rCD_precip';
case 12,
col = jetCD(6);
colormap_name = 'jetCD';
case 13,
col = jetCD(6,'season');
colormap_name = 'jetCD_season';
case 14,
col = hotCD(12);
colormap_name = 'hotCD';
case 15,
col = hotCD(12,'y');
colormap_name = 'hotCD_y';
case 16,
col = hotCD(12,'g');
colormap_name = 'hotCD_g';
case 17,
col = hotCD(12,'c');
colormap_name = 'hotCD_c';
case 18,
col = hotCD(12,'b');
colormap_name = 'hotCD_b';
case 19,
col = hotCD(12,'m');
colormap_name = 'hotCD_m';
case 20,
col = hotCD(12,'gry');
colormap_name = 'hotCD_gry';
case 21,
col = detailCD(6);
colormap_name = 'detailCD';
case 22,
col = detailCD(6,'double');
colormap_name = 'detailCD_double';
case 23,
col = b2rCD(9);
colormap_name = 'b2rCD_9';
case 24,
col = flipud(detailCD(6,'double'));
colormap_name = 'detailCD_double_rev';
end
figure(1); clf; hold on;
for i = 1:size(col,1)
patch([0 1 1 0]+i,[0 0 1 1],col(i,:),'linest','none');
end
plot([1 i+1 i+1 1 1],[0 0 1 1 0],'k-','linewi',2)
set(gcf,'position',[1 10 14 1],'unit','inches');
set(gcf,'position',[1 10 14 1],'unit','inches');
set(gcf,'color','w')
axis off
set(gcf, 'PaperPositionMode','auto');
print(gcf,'-dpng','-r300',['demo/',colormap_name,'_colorbar.png'])
end
if 0,
figure(2); clf;
z = peaks;
z = z/8*6;
for ct = 1:2
subplot(1,2,ct);hold on;
contourf(z,[-6:1/5:6],'linest','none');
colorbar;
caxis([-6 6])
axis off
plot([1 49 49 1 1],[1 1 49 49 1],'k-','linewi',2)
set(gca,'fontsize',18)
daspect([1 1 1])
if ct == 1,
title('Before')
switch case_id,
case 1,
colormap(gca,flipud(hot(12)));
case 2,
colormap(gca,jet(12));
case 3,
temp = [repmat([0:1/5:1]',1,2) ones(6,1); ...
ones(6,1) repmat([1:-1/5:0]',1,2) ];
colormap(gca,temp);
case 4,
colormap(gca,autumn(12));
case 5,
colormap(gca,lines(30));
case 6,
colormap(gca,pink(12));
end
else
title('After')
colormap(gca,col);
end
end
set(gcf,'position',[1 10 14 5],'unit','inches');
set(gcf,'position',[1 8 14 7],'unit','inches');
set(gcf,'color','w')
set(gcf, 'PaperPositionMode','auto');
print(gcf,'-dpng','-r300',['demo/',colormap_name,'_compare.png'])
end