MATLAB的Bar3函数调节渐变色(内附渐变色库.mat及.m文件免费下载链接)

一. colormap函数

可以使用colormap函数:

bash 复制代码
t1=[281.1,584.6, 884.3,1182.9,1485.2;
291.6,592.6,896,1197.75,1497.33;
293.8,596.4,898.6,1204.4,1506.4;
295.8,598,904.4,1209.0,1514.6];

bar3(t1,1)
set(gca,'XTickLabel',{'300','600','900','1200','1500'},'FontSize',10)
set(gca,'YTickLabel',{'2','3','4','5'},'FontSize',10)
zlabel('Length (mm)','FontSize',10);
xlabel('Theoretical (mm)','FontSize',10);
ylabel('F','FontSize',10);

% grid on

for i = 1:size(t1,1)
    for j = 1:size(t1,2)
        text(j*0.9, i*1.05, t1(i,j)*1.1, num2str(t1(i,j)),'FontSize',8);
    end
end

colormap summer

colormap的颜色选择:

二. colormap颜色的扩展

使用othercolor,修改最后一行colormap summer为:

bash 复制代码
colormap(othercolor('PuBu6'))

注意othercolor非自带函数,需要自己添加:

相关链接:othercolor - File Exchange - MATLAB Central (mathworks.cn)

如何设置全局使用:

参见:MATLAB添加自编写.m文件或.mat数据并永久全局调用方法-CSDN博客

othercolor包括,选择自己想要的代码就可以:

相关推荐
木斯佳12 小时前
前端八股文面经大全:京东零售JDY前端一面(2026-04-14)·面经深度解析
前端·算法·设计模式·ai·断点续传
耗子君QAQ12 小时前
🔧 Rattail | 面向 Vite+ 和 AI Agent 的前端工具链
前端·javascript·vue.js
Bigger12 小时前
面试官问我:“AI 写代码比你快 100 倍,你的价值在哪?”
前端·面试·ai编程
凤年徐12 小时前
【Linux从入门到进阶】打包压缩、跨平台互传、内核版本、热键历史、关机与Shell原理一篇全搞定
linux·运维·服务器
i建模12 小时前
Linux 服务器上配置 XFCE 桌面以实现远程登录
linux·运维·服务器
辰风沐阳13 小时前
nvm - node 版本管理工具【macOS/Linux】
linux·运维·macos
恋恋风尘hhh14 小时前
滑动验证码前端安全研究:以顶象(dingxiang-inc)为例
前端·安全
君穆南20 小时前
基于 NFS 与 Rsync 实现跨服务器 Seafile 数据平滑迁移实战
linux·运维·git
bloglin9999920 小时前
scp、rsync远程文件同步
linux·运维·服务器
迦南的迦 亚索的索21 小时前
LINUX环境
linux·运维·服务器