跳转至

showConnData

可视化颗粒群的连接状态

语法

showConnData(mPos,cList,cW,cC)
showConnData(mPos,cList)
showConnData(mPos,cList,cW)
showConnData(...,M)
showConnData(AX,...)
H = showConnData(...)

描述

showConnData(mPos, cList) visualize connections defined by the points (mPos) and point pairs(cList). Mark with LINE, with the same width and black color.

showConnData(mPos, cList, cW) visualize connections, mark with a narrow RECTANGLE or TUBE of different width. The width varies with cW.

showConnData(mPos, cList, cW, cC) visualize connections, mark with a narrow RECTANGLE or TUBE of different width and different color. The width varies with cW, the color varies with cC. TODO: interp color along each connection.

showConnData(__, M) visualize with the marker M('line','rect','tube')

showConnData(AX, __) plots into AX instead of GCA

H = showConnData(__) returns a PATCH or SURFACE handle in H.

__ = showConnData(__, pvpairs) sets the value of the specified surface property. Multiple property values can be set with a single statement.

示例——基本图元与数据可视化

线条(1维)

无线宽, 数据可视化时仅映射为颜色

mPos = [zeros(1,3);[sqrt(8)/3*cosd(30:120:270)',sqrt(8)/3*sind(30:120:270)',zeros(3,1)-1/3];0,0,1];
cList = [1,2;1,3;1,4;1,5];
mValue = rand(5,1);
cValue = rand(4,1);

nexttile
showConnData(mPos, cList, 'line');
title('线条, 统一着色(默认为绿色)');
nexttile
showConnData(mPos, cList, 0, cValue, 'EdgeColor', 'flat');
colormap(gca, [0,1,0;1,0,0]);
title('线条, 基于连接属性单一着色');
nexttile
showConnData(mPos, cList, 0, mValue);
title('线条, 基于颗粒属性单一着色');
nexttile
showConnData(mPos, cList, 0, mValue,'EdgeColor','interp');
title('线条, 基于颗粒属性插值着色');

矩形(2维)

数据可视化时可映射为宽度、颜色或(透明度)

mPos = [zeros(1,3);[sqrt(8)/3*cosd(30:120:270)',sqrt(8)/3*sind(30:120:270)',zeros(3,1)-1/3];0,0,1];
cList = [1,2;1,3;1,4;1,5];
mValue = rand(5,1);
cValue = rand(4,1);

figure;
nexttile
showConnData(mPos, cList, 'rect');
title('矩形, 线宽 + 黑色');
nexttile
showConnData(mPos, cList, 1, cValue, 'rect', 'FaceColor', 'flat');
title('矩形, 固定线宽 + 单一着色');
nexttile
showConnData(mPos, cList, 1, mValue, 'rect');
title('矩形, 固定线宽 + 插值着色');
nexttile
showConnData(mPos, cList, cValue, mValue, 'rect','FaceColor','interp');
title('矩形, 线宽 + 插值着色');
snapnow;

圆柱

数据可视化时可映射为宽度、颜色或(透明度) 三维时可考虑光照增强立体感

figure;
mPos = [zeros(1,3);[sqrt(8)/3*cosd(30:120:270)',sqrt(8)/3*sind(30:120:270)',zeros(3,1)-1/3];0,0,1];
cList = [1,2;1,3;1,4;1,5];
mValue = rand(5,1);
cValue = rand(4,1);

nexttile
showConnData(mPos, cList, cValue);
camlight;
title('圆柱, 线宽');
nexttile
showConnData(mPos, cList, 1, cValue,'FaceColor', 'flat');
camlight;
title('圆柱, 固定线宽 + 基于连接属性单一着色');
nexttile
showConnData(mPos, cList, 1, mValue);
camlight;
title('圆柱, 固定线宽 + 基于颗粒属性两段着色');
nexttile
showConnData(mPos, cList, cValue, mValue,'FaceColor','interp');
camlight;
title('圆柱, 线宽 + 基于颗粒属性插值着色');
snapnow;

CH4球棍模型

mPos = [zeros(1,3);[sqrt(8)/3*cosd(30:120:270)',sqrt(8)/3*sind(30:120:270)',zeros(3,1)-1/3];0,0,1];
cList = [1,2;1,3;1,4;1,5];
mValue = [2,1,1,1,1]';

figure
s = struct('X',mPos(:,1),'Y',mPos(:,2),'Z',mPos(:,3),'R',0.2*[1.5;ones(4,1)],'groupId',mValue);
bfs.show(s);

hold on
showConnData(mPos, cList, 1, mValue, 'tube','FaceLighting','gouraud');
colormap([1,0,0;1,1,1]);axis off;
hold off;
% snapnow;

NaCl球棍模型

n=3;
[mX,mY,mZ]=ndgrid(1:n);
mPos=[mX(:),mY(:),mZ(:)];

mI=reshape(1:length(mPos),size(mX));
cList=[reshape(mI(1:end-1,:,:),[],1),reshape(mI(2:end,:,:),[],1);
    reshape(mI(:,1:end-1,:),[],1),reshape(mI(:,2:end,:),[],1);
    reshape(mI(:,:,1:end-1),[],1),reshape(mI(:,:,2:end),[],1)];

mValue =  mod(mI(:),2)+1;
s = struct('X',mPos(:,1),'Y',mPos(:,2),'Z',mPos(:,3),'R',0.2*(mValue/2+0.5),'groupId',mValue);

% subplot(1,2,1)
bfs.show(s);
hold on
showConnData(mPos, cList, 1/2, mValue,'FaceLighting','gouraud');
colormap([1,0,1;0,1,0]);axis off;
hold off;
snapnow;

% subplot(1,2,2)
bfs.show(s);
hold on
h = showConnData(mPos, cList, 1/2, 3,'FaceLighting','gouraud');
colormap([1,0,1;0,1,0;1,1,1]);axis off;
hold off;
snapnow;

%}

另请参阅

coneplot, scatter, scatter3

Copyright 2018-2024 The MatDEM teams.