当前位置:网站首页>MATLAB 44种动漫渐变色绘图程序
MATLAB 44种动漫渐变色绘图程序
2022-07-27 23:31:00 【Lwcah】
点击上方‘Lwcah’,关注我的公众号。
持续生产中,敬请观看~
绘图程序针对人群:使用MATLAB从事科研绘图,对颜色的掌控有较高要求。
该MATLAB函数用于自定义绘制渐变色,我们依据动漫的截图1:1制作了44种渐变色,可供科研成图选择。
截图来源参考:https://baijiahao.baidu.com/s?id=1671258205062995017&wfr=spider&for=pc
下面给出三维柱状图绘制程序demo_plotbar3.m;其中mymap.p子函数即为我们的绘图产品;mymap.pdf为该产品的说明书,如下图所示,共计44张对照图。
%% 三维柱状图的绘制模板
close all;clear all;clc;
%% 1行1列
%定义整幅图出现的在电脑屏幕上的位置以及长和宽
figureHandle = figure;
figureUnits = 'centimeters';
figureWidth = 10;
figureHeight = 6;
set(gcf, 'Units', figureUnits, 'Position', [0 0 figureWidth figureHeight]);
%% 数据准备
% 定义自变量
X = [1 2 3 4 5 6 7 8 9 10 11 12 13];%13
Y = [1 2 3 4];%4
% 定义因变量
Z1 = [1 2 3 4 5 6 7 6 5 4 3 2 1];
Z2 = [2 3 4 5 6 7 7 7 6 5 4 3 2];
Z3 = [2 3 4 5 6 7 7 7 6 5 4 3 2];
Z4 = [1 2 3 4 5 6 7 6 5 4 3 2 1];
Z=[Z1;Z2;Z3;Z4];%4x13
%% 给定绘图字体和字号
fontnamed='Arial';%字号名字
ssize=10;%字号大小
%% 给定绘图渐变色
CM1 = mymap(34);%如果要更改渐变色的话,只需要更改34为1-44之间的任意一个数即可。
%% 定义绘图参数
b = bar3(Z,0.5);
% hTitle = title(sprintf('(a) RMSE/m (free snow)'));
hXLabel = xlabel('Types','fontsize',ssize,'FontName',fontnamed,'rotation',45);
hYLabel = ylabel('Solutions','fontsize',ssize,'FontName',fontnamed,'rotation',-45);
hZLabel = zlabel('Values','fontsize',ssize,'FontName',fontnamed);
%% 按照Z轴赋色
for k = 1:length(b)
zdata = b(k).ZData;
b(k).CData = zdata;
b(k).FaceColor = 'interp';
end
colormap(CM1);%使用自定义的颜色
cb = colorbar;%添加垂直颜色栏
set(cb,'unit','centimeters','position',[9.3,2.8,0.2,2.5]);%设置垂直颜色栏的位置及大小
%% 画图的标准格式代码
% text(0.5,0.9,'(a) snow','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
% xlabel('SNR types','fontsize',ssize,'FontName',fontnamed);
% ylabel('R (with snow)','fontsize',ssize,'FontName',fontnamed);
axis([0 14 0 5 0 8]);%XYZ轴的范围
xticks([1 2 3 4 5 6 7 8 9 10 11 12 13]);%画格网的时候的小刻度
xticklabels({'1','2','3','4','5','6','7','8','9','10','11','12','13'});%加x轴刻度标注,'C3-MEO-S2I','C3-MEO-S6I'
yticks([1 2 3 4]);%画格网的时候的小刻度
yticklabels({'1','2','3','4'});%加x轴刻度标注
zticks([0 2 4 6 8]);%画格网的时候的小刻度
zticklabels({'0','2','4','6','8'});%加x轴刻度标注
set(gca,'xticklabelrotation',-45);
set(gca,'yticklabelrotation',45);
% set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
% set(gca,'yticklabel',[]);%y轴不显示
% set(gca,'xticklabel',[]);%x轴不显示
grid on;box on;hold on;
%% 背景颜色
set(gcf,'Color',[1 1 1])
%% 设置完毕后,按照所需分辨率、格式输出
figW = figureWidth;
figH = figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0 0 figW figH]);
fileout = 'bar3_1';
print(figureHandle,[fileout,'.png'],'-r800','-dpng');











注:因该产品为作者自行科研需求而制作,故不打算免费公开获取,如有需要,请公众号后台回复关键词:mymap。自助获取。谢谢~
万请尊重原创成果!!!
声明:本公众号的原创成果,在未经允许的情况下,请勿用于任何商业用途!
您的每一次点赞,在看,关注和分享都是对我最大的鼓励~谢谢~

边栏推荐
- C language main function transfer parameters
- Software test interview question: what are the performance test indicators?
- Kibana6.2.4 version update x-pack certification
- MySQL JPA support for JSON type data in database
- Learn how Baidu PaddlePaddle easydl realizes automatic animal recognition in aquarium
- Fluent call interface UI
- 逻辑回归原理
- 软件测试面试题:如何准备测试数据?如何防止数据污染?
- Gazebo 控制实例
- Wu xiongang sent an internal letter: arm's allegations are unwarranted, and no damage is allowed to the existing achievements!
猜你喜欢

Leetcode 2351. the first letter that appears twice

Flutter--密码登录注册界面

画刷和画笔

Anfulai embedded weekly report no. 275: 2022.07.18--2022.07.24

Three instance

Summary of common shortcut keys in idea

Oxygen temperature and humidity module

Lecture 16 of project practice: using the open close principle to realize the commodity price rule engine

LeetCode 2341. 数组能形成多少数对

同心向前,Google Play 十周年啦!
随机推荐
JS global function method module exports exports
MySQL进阶--存储过程以及自定义函数
C language main function transfer parameters
Learn how Baidu PaddlePaddle easydl realizes automatic animal recognition in aquarium
Three instance
BYD semiconductor completed the a+ round financing of 800million yuan: 30 well-known investment institutions entered the market, with a valuation of 10.2 billion yuan!
Interpretation of new features | the restriction of MySQL 8.0 on gtid is lifted
idea常用的快捷键汇总
Let's move forward together, the 10th anniversary of Google play!
Leetcode 2351. the first letter that appears twice
How the test architects of bat factories interpret various disputes of the test platform
URDF 集成 Gazebo
Shenzhen Huaqiang announced that it plans to invest no more than 20million yuan in BYD semiconductor
LeetCode 2347. 最好的扑克手牌
对迁移学习中域适应的理解和3种技术的介绍
Shutter -- password login registration interface
Day 013 one dimensional array exercise
Transplant QT system for i.mx6ull development board - cross compile QT code
S-RPN: Sampling-balanced region proposal network for small crop pest detection
字节月薪28K,分享一波我的自动化测试经验....