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

相关推荐
cccccc语言我来了25 分钟前
Linux (11) 进程控制
linux·运维·数据库
菜菜的院子31 分钟前
WSL2 运行 Ubuntu 26.04 完整 GNOME 桌面(WSLg Wayland)
linux·运维·ubuntu·wsl
暖核39 分钟前
从 CentOS 到 Ubuntu24.04 运维迁移手册:命令对照表 + 实操 + 避坑
linux·运维·centos
pride.li42 分钟前
第12章 Python 教程-流程控制:循环结构
linux·服务器·python·算法
迷途之人不知返1 小时前
【基础IO】-5-简单理解三个标准流——stdin、stdout、stderr
linux
牛马鸡niumasi1 小时前
【Linux】进程退出
linux
鬼手点金1 小时前
模型即 Agent:当模型本身成为产品
开发语言·前端·人工智能·python·机器学习
kiracrimson1 小时前
npm 入门:包管理器、依赖与 npx
前端·npm·node.js
ShineWinsu1 小时前
对于JavaScript:初识JavaScript以及输入输出
java·开发语言·前端·javascript·css·面试·html