当前位置:网站首页>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()
不想看了,摆烂
边栏推荐
- Error: Not a signal or slot declaration
- 02 [Development Server Resource Module]
- 多线程(2)
- Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
- 使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号
- 直播预告|30分钟快速入门!来看可信分布式AI链桨的架构设计
- 继承关系下构造方法的访问特点
- [机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
- PHP Skills Assessment
- DAY23:命令执行&代码执行漏洞
猜你喜欢

2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。

优化Feed流遭遇拦路虎,是谁帮百度打破了“内存墙”?

02 【开发服务器 资源模块】
ROS通信 —— 服务(Service)通信](/img/4d/4657f24bd7809abb4bdc4b418076f7.png)
[ROS](10)ROS通信 —— 服务(Service)通信

【OpenCV 图像处理2】:OpenCV 基础知识

在这个超连接的世界里,你的数据安全吗

Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?

CPDA|运营人如何从负基础学会数据分析(SQL)

hypervisor相关的知识点

iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
随机推荐
在这个超连接的世界里,你的数据安全吗
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
Greenplum数据库故障分析——能对数据库base文件夹进行软连接嘛?
海量服务实例动态化管理
Transfer Learning - Distant Domain Transfer Learning
Solve connect: The requested address is not valid in its context
Domain Driven Design - MDD
Access Characteristics of Constructor under Inheritance Relationship
英特尔 XDC 2022 精彩回顾:共建开放生态,释放“基建”潜能
[ROS] (10) ROS Communication - Service Communication
[机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
Understand the recommendation system in one article: Recall 06: Two-tower model - model structure, training method, the recall model is a late fusion feature, and the sorting model is an early fusion
mysql树状结构查询问题
学习笔记-----左偏树
.Net C# Console Create a window using Win32 API
后期学习计划
C学生管理系统 指定位置插入学生节点
Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit
基于左序遍历的数据存储实践
How do programmers without objects spend the Chinese Valentine's Day