Mathematica中文论坛-非官方
标题:
豆粑粑 画不同透明度的圆
[打印本页]
作者:
meatball1982
时间:
2016-10-23 09:54
标题:
豆粑粑 画不同透明度的圆
别人的问题,在一个图里画不同透明度的圆。
MinVal = -1;
MaxVal = 1;
MaxRadius = 0.5;
nCircles = 10;
Dimension = 2;
Circles = zeros(nCircles, Dimension);
Radius = zeros(nCircles, 1);
cmap = jet(nCircles); %// define colors.
alpha = .1; %// define level of transparency
for i = 1 : nCircles
Circles(i,:) = unifrnd(MinVal, MaxVal, [1, Dimension]);
Radius(i) = unifrnd(0, MaxRadius, 1);
end
t = 0 : .1 : 2 * pi;
hold on;
for i = 1 : nCircles
x = Radius(i) * cos(t) + Circles(i,1);
y = Radius(i) * sin(t) + Circles(i,2);
patch(x, y, 'none', 'facecolor', cmap(i,:), 'facealpha', alpha*i, ...
'edgecolor', 'none'); %// plot filled circle with transparency
end
axis equal; %// same aspect ratio in both axes
grid on;
复制代码
fig_circle_alpha_mul.png
(71.15 KB, 下载次数: 1332)
下载附件
2016-10-23 09:53 上传
欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/)
Powered by Discuz! X3.2