当前位置:网站首页>Matlab drawing 3
Matlab drawing 3
2022-08-05 02:33:00 【Ten thousand years old bamboo】
Matlab画图 3
1.练习:Complete the effect of the picture below

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
适用场景:When a multi-dimensional image is difficult to visually reflect changes in values,利用imagescThe function displays the image using color;ColorBarIt acts as a legend in the figure,ColorMapYou can adjust the color temperature
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()The difference is that there will be one more at the bottomcontour图像
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()
不想看了,摆烂
边栏推荐
猜你喜欢
随机推荐
dmp(dump)转储文件
力扣-二叉树的前序遍历、中序遍历、后序遍历
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
如何逐步执行数据风险评估
继承关系下构造方法的访问特点
【LeetCode刷题】-数之和专题(待补充更多题目)
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
Using OpenVINO to implement the flying paddle version of the PGNet inference program
正则表达式,匹配中间的某一段字符串
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
sql语句多字段多个值如何进行排序
Snapback - same tree
DAY23:命令执行&代码执行漏洞
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
力扣-二叉树的最大的深度
1667. 修复表中的名字
C student management system head to add a student node
Chinese characters to Pinyin
汉字转拼音
蚁剑高级模块开发









