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包括,选择自己想要的代码就可以:

相关推荐
土豆125014 分钟前
Tauri 入门与实践:用 Rust 构建你的下一个桌面应用
前端·rust
小陈工2 小时前
2026年4月2日技术资讯洞察:数据库融合革命、端侧AI突破与脑机接口产业化
开发语言·前端·数据库·人工智能·python·安全
IT_陈寒2 小时前
Vue的这个响应式问题,坑了我整整两小时
前端·人工智能·后端
C澒2 小时前
AI 生码:A 类生码方案架构升级
前端·ai编程
风曦Kisaki3 小时前
# Linux 磁盘查看命令详解:df 与 du
linux·运维·网络
路溪非溪3 小时前
Linux中gpio子系统的现代接口
linux·arm开发·驱动开发
前端Hardy3 小时前
前端必看!LocalStorage这么用,再也不踩坑(多框架通用,直接复制)
前端·javascript·面试
前端Hardy3 小时前
前端必看!前端路由守卫这么写,再也不担心权限混乱(Vue/React通用)
前端·javascript·面试
Lee川3 小时前
从零构建现代化登录界面:React + Tailwind CSS 前端工程实践
前端·react.js
Awu12273 小时前
⚡精通 Claude 第 1 课:掌握 Slash Commands
前端·人工智能·ai编程