-
Notifications
You must be signed in to change notification settings - Fork 6
/
alpha_fig.m
88 lines (76 loc) · 2.05 KB
/
alpha_fig.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
%% alpha show
% wendylay
% 2021.12.19
clc; clear; close all;
rng(0)
%% generate data
n_p = 20;
x1 = randn(1, n_p) + randn(1, n_p) * 1;
y1 = randn(1, n_p) + randn(1, n_p) * 2;
x2 = randn(1, n_p) + randn(1, n_p) * 1;
y2 = randn(1, n_p) + randn(1, n_p) * 2;
for idx = 1 : n_p
if mod(idx, 2) ~= 1
x2(idx) = x1(idx) + randn(1) .* 0.5;
y2(idx) = y1(idx) + randn(1) .* 0.5;
end
end
% scatter(x1, y1, 100, 's', 'MarkerFaceColor', 'b');
% alpha(.1)
% hold on
% scatter(x2, y2, 100, '^', 'MarkerFaceColor', 'r');
%% figure
rng(0)
light_blue = [216,220,254] ./ 255;
light_red = [250,220,218] ./ 255;
%% no alpha
figure
scatter(x1, y1, 150, ...
'MarkerFaceColor', light_blue,...
'MarkerEdgeColor', light_blue - 0.3,'LineWidth', 1.5)
hold on
scatter(x2, y2, 150, ...
'MarkerFaceColor', light_red,...
'MarkerEdgeColor', light_red - 0.3,'LineWidth', 1.5, ...
'Marker', 's')
set(gca, 'linewidth', 1.25, 'fontsize', 16,...
'xcolor', 'k', 'ycolor', 'k')
box on
print(gcf, '-djpeg', '-r300', 'no_alpha.jpg')
close all
%% Face and Edge Alpha
figure
scatter(x1, y1, 150, ...
'MarkerFaceColor', light_blue,...
'MarkerEdgeColor', light_blue - 0.3,...
'LineWidth', 1.5,...
'MarkerFaceAlpha', 0.6, ...
'MarkerEdgeAlpha', 0.8)
hold on
scatter(x2, y2, 150, ...
'MarkerFaceColor', light_red,...
'MarkerEdgeColor', light_red - 0.3,'LineWidth', 1.5, ...
'Marker', 's',...
'MarkerFaceAlpha', 0.6,...
'MarkerEdgeAlpha', 0.8)
set(gca, 'linewidth', 1.25, 'fontsize', 16,...
'xcolor', 'k', 'ycolor', 'k')
box on
print(gcf, '-djpeg', '-r300', 'alpha_face_edge.jpg')
close all
%% Figure alpha
figure
scatter(x1, y1, 150, ...
'MarkerFaceColor', light_blue,...
'MarkerEdgeColor', light_blue - 0.3,'LineWidth', 1.5)
hold on
scatter(x2, y2, 150, ...
'MarkerFaceColor', light_red,...
'MarkerEdgeColor', light_red - 0.3,'LineWidth', 1.5, ...
'Marker', 's')
set(gca, 'linewidth', 1.25, 'fontsize', 16,...
'xcolor', 'k', 'ycolor', 'k')
box on
alpha(1)
print(gcf, '-djpeg', '-r300', 'alpha_all_figure.jpg')
close all