Matlab 绘图 曲线颜色自定义

Matlab 绘图 曲线颜色自定义 同时组合图内间距小

  1. 确定绘制曲线的RGB颜色
  2. 根据RGB颜色将其除以255归一化到0-1,plot中选择属性’color’为RGB值即可。
  3. 示例如下
rn = 2;  % The number of rows
cn = 2;  % The number of columns

% color1 = [34 139 34];
% color2 = [255 215 0];
% color3 = [205 92 92];
% color4 = [210 105 30];

color1 = [205 205 0];
color2 = [139 101 8];
color3 = [205 155 155];
color4 = [238 121 66];
linewidth1 = 2;
figure;
ha = tiledlayout(rn,cn,'TileSpacing','Compact','Padding','Compact');

X=[0	5	10	15	20 25 30 35];
Y=[11.6468	5.1099	3.326	2.3581	2.1535	1.9456	1.916	1.931;
11.364	5.0842	3.5273	2.5558	1.9321	1.8705	1.8567	1.8674;
12.1578	4.8974	3.1736	2.4388	1.9552	2.0668	1.8699	1.6778;
10.6016	5.0739	3.2126	2.3368	2.007	1.9236	1.8906	1.8702];

nexttile
plot(X,Y(1,:),'o-','color',color1/255,'linewidth',linewidth1)
nexttile
plot(X,Y(2,:),'o-','color',color2/255,'linewidth',linewidth1)
nexttile
plot(X,Y(3,:),'o-','color',color3/255,'linewidth',linewidth1)
nexttile
plot(X,Y(4,:),'o-','color',color4/255,'linewidth',linewidth1)

颜色截取自链接
在这里插入图片描述![在这里插入图片描述](https://img-blog.csdnimg.cn/15aeddaa973b463f9e32617b0d9abadf.png

  1. 左边颜色绘制如下
    在这里插入图片描述
  2. 右边颜色绘制如下
    在这里插入图片描述
  • 8
    点赞
  • 112
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值