-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_oppo3.m
69 lines (64 loc) · 1.81 KB
/
test_oppo3.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
% generate the full colormap
n_colors=256;
x=linspace(0,1,n_colors+1)';
x=x(1:end-1);
cmap=oppo3_of_x(x);
% % show it
% figure('color', 'w');
% colormap(cmap);
% colorbar;
% colorbar_axes_h=findobj(gcf,'Tag','Colorbar');
% colorbar_image_h=findobj(colorbar_axes_h,'Tag','TMW_COLORBAR');
% set(colorbar_image_h,'YData',[-180 +180]);
% set(colorbar_axes_h,'YLim',[-180 +180]);
% set(colorbar_axes_h,'YTick',[-180 -90 0 +90 +180]);
% show the colormap a prettier way
theta=(-pi:pi/100:+pi)';
theta=repmat(theta,[1 2]);
r=repmat([0.8 1],[size(theta,1) 1]);
im_index=round(255*(((theta/pi)+1)/2))+1;
im_rgb=ind2rgb(im_index,cmap);
x=r.*cos(theta);
y=r.*sin(theta);
figure('color', 'w');
polar_grid_super_simple();
hold on;
surf(x,y,zeros(size(x)),...
im_rgb,...
'EdgeColor','none');
hold off;
text(0,0,'oppo3_of_x',...
'interpreter','none',...
'horizontalalignment','center',...
'verticalalignment','middle');
% make a colormap with inter-color spacings equal
n_colors=256;
cmap=oppo3(n_colors);
% % show the colormap
% figure('color', 'w');
% colormap(cmap);
% colorbar;
% colorbar_axes_h=findobj(gcf,'Tag','Colorbar');
% colorbar_image_h=findobj(colorbar_axes_h,'Tag','TMW_COLORBAR');
% %set(colorbar_image_h,'YData',[-180 +180]);
% set(colorbar_axes_h,'Limits',[-180 +180]);
% set(colorbar_axes_h,'Ticks',[-180 -90 0 +90 +180]);
% show the colormap a prettier way
theta=(-pi:pi/100:+pi)';
theta=repmat(theta,[1 2]);
r=repmat([0.8 1],[size(theta,1) 1]);
im_index=round(255*(((theta/pi)+1)/2))+1;
im_rgb=ind2rgb(im_index,cmap);
x=r.*cos(theta);
y=r.*sin(theta);
figure('color', 'w');
polar_grid_super_simple();
hold on;
surf(x,y,zeros(size(x)),...
im_rgb,...
'EdgeColor','none');
hold off;
text(0,0,'oppo3',...
'interpreter','none',...
'horizontalalignment','center',...
'verticalalignment','middle');