matlab学习day2:图形着色处理

1. colormap函数
用法:colormap(map);将图形设置为map颜色
colormap(‘default’);设置当前图形的颜色为默认颜色
cmap=colormap;获取当前图形的颜色矩阵
举例:
[x,y,z]=sphere(40);%画球体
mesh(x,y,z);
colormap(jet);
在这里插入图片描述
colormap中的颜色可以是自己定义的RGB颜色向量如[0,0,1],也可以使用matlab提供的颜色函数(jet、hsv、hot、cool、spring、summer、autumn、winter、gray、bone、copper、pink、lines)。
2. shading函数
用法:
shading faceted;
shading flat;
shading interp;
举例:
subplot(3,1,1);
sphere(16);
axis square;
shading faceted;
title(‘1’);

subplot(3,1,2);
sphere(16);
axis square;
shading flat;
title(‘2’);

subplot(3,1,3);
sphere(16);
axis square;
shading interp;
title(‘3’);
在这里插入图片描述
3. caxis函数
用法:
caxis([cmin cmax]);将颜色限制在cmin和cmax之间,小于cmin的使其为cmin,大于cmax的使其为cmax。
caxis auto;默认,自动计算颜色最大值和最小值
caxis manual;
v=caxis;返回包含颜色最大值和最小值的向量
举例:
[x,y]=meshgrid(-6:.5:6);
z=x.^2+y .^2;
surf(x,y,z);
caxis([0 40]);
v=caxis
**
在这里插入图片描述
4. brighten函数
用法:
brighten(beta);当beta取[0,1]时,图形变亮;当beta取[-1,0]时,图形变暗;
5. colorbar函数
用法:
colorbar;在当前轴右边显示颜色刻度
colorbar(‘off’); colorbar(‘hide’); colorbar(‘delete’);关闭当前图形所有轴的颜色标尺
colorbar(‘location’,‘North’);在图形中确定的地方产生颜色标尺
6. colordef函数
设置图形背景颜色
用法:
colordef white;设置图形的背景颜色为白色;
colordef black;设置图形的背景颜色为黑色;
colordef none;将图形的背景颜色设置为软件默认的颜色;

  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值