Mathematica中文论坛-非官方
标题:
豆粑粑 matlab 4D slice transparent
[打印本页]
作者:
meatball1982
时间:
2017-9-20 09:11
标题:
豆粑粑 matlab 4D slice transparent
file_3d_grid_hot.png
(287.41 KB, 下载次数: 1473)
下载附件
2017-9-20 09:11 上传
clear all
clc
close all
%% outline
% plot scatter points, surf, countour3D
%% main
% load data ---------------------------------------------------------------
% dat=load('./cv_357.txt');
% n=length(dat(:,1));
%
% x=dat(:,1);
% y=dat(:,2);
% z=dat(:,3);
%
% % grid size ---------------------------------------------------------------
% n_cv=30;
% cv_g=linspace(-pi,pi,n_cv);
%
% cv_int=0.5; % 2 calculate point denisty, half of cubic size
% cv_x=cv_g;
% cv_y=cv_g;
% cv_z=cv_g;
%
% [cv_X,cv_Y,cv_Z]=meshgrid(cv_g,cv_g,cv_g);
%
% % points denisty ----------------------------------------------------------
% for i=1:n_cv
% ind_x= (x>=cv_x(i)-cv_int) & (x<cv_x(i)+cv_int);
% for j=1:n_cv
% ind_y= (y>=cv_y(j)-cv_int) & (y<cv_y(j)+cv_int);
% for k=1:n_cv
% ind_z= (z>=cv_z(k)-cv_int) & (z<cv_z(k)+cv_int);
% p_n = sum(ind_x & ind_y & ind_z);
% cv_V(j,i,k)= p_n;
% end
% end
% end
%
% save Mat_cv.mat
load Mat_cv.mat
cv_V=smooth3(cv_V,'box',3);
% potential( u can mod the value with your style ---------------------
cv_V=-log(cv_V./sum(cv_V(:)));
tm = cv_V(cv_V~=Inf);
cv_V(cv_V==Inf)=max(tm);
cv_V=cv_V-min(cv_V(:));
cv_V(cv_V>3.7)=NaN;
% slice u want 2 plot ---------------------------------------
xslice = cv_x(1:1:n_cv);
yslice = cv_y(1:1:n_cv);
zslice = cv_z(1:1:n_cv);
h=slice(cv_X,cv_Y,cv_Z,cv_V,xslice,yslice,zslice);
for i = 1:3*n_cv
set(h(i),'EdgeColor','none','FaceColor','interp',...
'FaceAlpha',0.01+0.008*(n_cv-mod(i,n_cv))) ;
end
% set only one alpha value ----------------------------------
% set(h,'EdgeColor','none','FaceColor','interp',...
% 'FaceAlpha',0.2) ;
% choose the colormap u want ---------------------------------
colormap(flipud(hot))
% colormap((hot))
% just figure setting -----------------------------------------
axis tight equal
set(gca,'GridLineStyle',':')
box on
ax=gca;
ax.BoxStyle = 'full';
grid on
axis([-pi pi -pi pi -pi pi])
view(20,20)
h = gcf;
fig_na=['./file_3d_grid_hot'];
fun_work_li_035_myfig_out(h,fig_na,3)
%% logs
% mod : 2017年 09月 20日 星期三 09:15:39 CST
% if u have question about this code. contact me
% meatball1982@163.com
%
复制代码
欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/)
Powered by Discuz! X3.2