《数据可视化ppt课件.ppt》由会员分享,可在线阅读,更多相关《数据可视化ppt课件.ppt(37页珍藏版)》请在三一办公上搜索。
1、第四课数据可视化,二维绘图三维绘图显示图像,实验内容:用图形表示离散函数,n = 0:12;y=1./abs(n+eps-6);plot(n,y,r*,MarkerSize,20);grid on,用图形表示连续函数,对连续函数进行离散化。基本方法:采样。采样密度。,可视化的一般步骤,绘制二维图形绘制三维图形,实验内容:绘制二维图形,数据准备选定图形窗或子图位置调用绘图指令设置显示值范围、刻度和坐标分格线图形注释图形的精细修饰,数据准备,产生自变量的采样向量及定义域;计算相应的函数值,相应得到值域。matlab:t = pi*(0:100)/100;y = sin(t).*sin(9*t);,
2、选定图形窗及子图位置,缺省窗口用指令打开指定图形窗口和子图号matlab:figure(1);subplot(2,2,3);,调用绘图指令,线型色彩数据点matlab:plot(t,y,b-),线型,色彩,数据点,设置显示值范围、刻度和坐标分格线,matlab:axis(0,pi,-1,1);grid on;,常用坐标指令(一),常用坐标指令(二),图形注释,matlab:title(调制波形);xlabel(t); ylabel(y);legend(sin(t),sin(t)sin(9t);text(2,0.5,y=sin(t)sin(9t);,图形的精细修饰,matlab:set(h,Ma
3、rkerSize,10);,叠绘,t = 2*pi*(0:20)/20;y = cos(t).*exp(-0.4*t);stem(t,y,g);hold on;stairs(t,y,r);hold off;,实验内容:绘制三维图形,三维数据准备:曲线和曲面选定图形窗及子图位置设置显示值范围、刻度和坐标分格线图形注释着色、明暗、灯光和材质处理视点、三度(纵横高)比,绘制三维曲线,matlab:t = pi*(0:0.02:2);x = sin(t); y=cos(t); z = cos(2*t);plot3(x,y,z,b-,x,y,z,bd);view(-82,58), box on, leg
4、end(链,宝石);,绘制三维曲面,matlab:x = -10:0.1:10;y = -10:0.1:10;X,Y = meshgrid(x,y);Z = X.2+Y.2;mesh(Z);,基本三维绘图指令,曲线:plot3曲面:meshsurfstem3,n = 0:0.1:12;y = 1./abs(n+eps-6);h = plot(n,y,r*,MarkerSize,20);grid on title(调制波形);xlabel(t); ylabel(y);legend(sin(t)sin(9t);text(2,0.5,y=sin(t)sin(9t); set(h,MarkerSize
5、,10);,t = 2*pi*(0:20)/20;y = cos(t).*exp(-0.4*t);stem(t,y,g);hold on;stairs(t,y,r);hold off;,t = pi*(0:0.02:2);x = sin(t); y=cos(t); z = cos(2*t);plot3(x,y,z,b-,x,y,z,bd);view(-82,58), box on, legend(链,宝石);,x = -10:0.1:10;y = -10:0.1:10; X,Y = meshgrid(x,y);Z = X.2+Y.2;mesh(Z);,三维图形效果,透视镂空裁剪,透 视,X0,
6、Y0,Z0 = sphere(30);mesh(X0,Y0,Z0);shading interphidden offaxis equal, axis off,镂 空,t = linspace(0,2*pi,100); r = 1-exp(-t/2).*cos(4*t);x,y,z = cylinder(r,60);ii = find(x0);z(ii) = NaN;surf(x,y,z); colormap(spring); shading interp,裁 剪,x = -8:0.05:8; y = x; X,Y = meshgrid(x,y); ZZ = X.2-Y.2;ii = find(
7、abs(X)6|abs(Y)6);ZZ(ii) = zeros(size(ii);surf(X,Y,ZZ), shading interp; colormap(copper),特殊图形指令,面域图 area直方图 bar barh bar3 bar3h饼图 pie pie3填色图 fill fill3,面域图 area,x = -2:2y = 3,5,2,4,1;3,4,5,2,1;5,4,3,2,5cum_sum = cumsum(y);area(x,y,0)legend(因素A,因素B,因素C),grid on,colormap(spring),直方图 bar barh,x = -2:2y
8、 = 3,5,2,4,1;3,4,5,2,1;5,4,3,2,5subplot(1,2,1),bar(x,y,stacked)xlabel(x), ylabel(Sigma y), colormap(cool) legend(因素A,因素B,因素C)subplot(1,2,2), barh(x,y,grouped)xlabel(y), ylabel(x)legend(因素A,因素B,因素C),直方图 bar3 bar3h,subplot(1,2,1), bar3(x,y,1)xlabel(因素ABC), ylabel(x),zlabel(y)colormap(summer)subplot(1,
9、2,2), bar3h(x,y,grouped)ylabel(y), zlabel(x),饼图 pie pie3,a = 1,1.6,1.2,0.8,2.1;subplot(1,2,1), pie(a,1 0 1 0 0),legend(1,2,3,4,5);subplot(1,2,2), pie3(a),colormap(cool),填色图 fill,n = 10;dt = 2*pi/n; t = 0:dt:2*pi;t = t,t(1);x = sin(t); y = cos(t);fill(x,y,c); axis offgtext(十边行);,填色图 fill3,xc = ones(2,4)/2;x = xc;0 1 1 0;y = xc;0 0 1 1;z = 1 1 1 1;0 0 0 0;0 0 0 0;c = 1 0 0 1;0 1 0 1;0 0 1 0; fill3(x,y,z,c),view(-10,56),colormap coolxlabel(x), ylabel(y), box on, grid on,显示图像,imreadimshowdemomatlab:I = imread(image path);imshow(I);,
链接地址:https://www.31ppt.com/p-1340904.html