当前位置:网站首页>Matlab画图3
Matlab画图3
2022-08-05 02:31:00 【万年老竹】
Matlab画图 3
1.练习:完成下图的效果

G=[46 38 29 24 13]; S=[29 27 17 26 8]; B=[29 23 19 32 7];
h=bar(1:5,[G' S' B']);
set(h(1),'FaceColor',[1 1 0]);
set(h(2),'FaceColor',[0.7 0.7 0.7]);
set(h(3),'FaceColor',[1 0.6 0.1]);
title('Medal count for top 5countries in 2012 Olympics');
ylabel('Number of medals'); xlabel('Country');
set(gca, 'XTickLabel',{'USA','CHN','GBR','RUS','KCR'});
legend('Gold','Silver','Bronze');
结果如下

2.imagesc函数、color bar与color map
适用场景:多维图像难以直观反映值的变化时,利用imagesc函数使用颜色显示图像;ColorBar在图中起到图例的作用,ColorMap则可以调整色温
eg:
[x,y]=meshgrid(-3:.2:3,-3:.2:3);
z=x.^2+x.*y+y.^2;surf(x,y,z);box on;
set(gca,'FontSize',16);zlabel('z');
xlim([-4 4]);xlabel('x');ylim([-4 4]);ylabel('y');colormap('turbo');
imagesc(z);axis square;xlabel('x');ylabel('y');
colorbar;colormap('turbo');
结果如下
3.3D绘图 3D Plots
4.mesh()与surf()
mesh是表格,surface是表面
eg:
x=-3.5:0.2:3.5;y=-3.5:0.2:3.5;
[X,Y]=meshgrid(x,y);
Z=x.*exp(-X.^2-Y.^2);
subplot(1,2,1);mesh(X,Y,Z);
subplot(1,2,2);surf(X,Y,Z);
结果如下
meshc()和surfc()与mesh()与surf()的区别在于底部会多一个contour图像
5.Various Countour Plots
eg:
x=-3.5:0.2:3.5;y=-3.5:0.2:3.5;
[X,Y]=meshgrid(x,y);
Z=x.*exp(-X.^2-Y.^2);
subplot(1,2,1);mesh(X,Y,Z);
axis square
subplot(1,2,2);contour(X,Y,Z);
axis square;
结果如下:

6.view(),light(),patch()
不想看了,摆烂
边栏推荐
猜你喜欢
select 标签自定义样式
leetcode 15
What should I do if the self-incrementing id of online MySQL is exhausted?
2022 EdgeX中国挑战赛8月3日即将盛大开幕
【MySQL series】- Does LIKE query start with % will make the index invalid?
02 【开发服务器 资源模块】
KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)
iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
[ROS](10)ROS通信 —— 服务(Service)通信
C language implements a simple number guessing game
随机推荐
树表的查找
"Dilili, wait for the lights, wait for the lights", the prompt sound for safe production in the factory
在这个超连接的世界里,你的数据安全吗
.Net C# Console Create a window using Win32 API
2022 EdgeX中国挑战赛8月3日即将盛大开幕
01 【前言 基础使用 核心概念】
fragment可见性判断
散列表的查找(哈希表)
注意潍坊开具发票一般需要注意
Tree search (bintree)
【日常训练】1403. 非递增顺序的最小子序列
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
【C语言】详解栈和队列(定义、销毁、数据的操作)
Short domain name bypass and xss related knowledge
C学生管理系统 据学号查找学生节点
Amazon Cloud Technology joins hands with Thundersoft to build an AIoT platform for industry customers
Live preview | 30 minutes started quickly!Look at credible distributed AI chain oar architectural design
nodeJs--encapsulate routing
SuperMap支持的国产环境汇总
".NET IoT from scratch" series