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

相关推荐
独泪了无痕13 小时前
Lodash-JavaScript的实用工具库
前端·javascript
有趣的老凌13 小时前
用 Vibe Coding 搭了一个完整小程序「一定能成」
前端·javascript·后端
七歌杜金房1 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
kyriewen1 天前
Anthropic 估值逼近万亿美元,Claude Sonnet 5 + Claude Science 一天两连发
前端·ai编程·claude
小徐_23331 天前
Wot UI 2.2.0 发布:Button 新增 subtle,VideoPreview 预览体验继续增强
前端·微信小程序·uni-app
天蓝色的鱼鱼1 天前
关于 CSS 你可能不知道的属性,但关键时刻很有用
前端·css
泯泷1 天前
第 2 篇:设计第一套字节码:Opcode、Instruction 与 Constant Pool
前端·javascript·安全
妙码生花1 天前
从 PHP 到 AI + Golang,程序员自救转型手记(十五):优化细节、网络请求封装
前端·后端·ai编程
泯泷1 天前
第 1 篇:从 1 + 2 开始:亲手写出第一台 JSVM
前端·javascript·安全