使用matlab完成‘小火把‘的数组可视化

导入matlab可以生产色卡以及五张jpg图片

colormap(colorcube);
pcolor([1:64;1:64]);
saveas(gcf,'mycolor.jpg');
f1=[1,1,1,1,1;1,1,1,1,1;...
    2,2,1,1,1;1,2,1,1,1;...
    1,1,2,1,1;1,1,2,2,1;...
    1,2,2,2,2;2,2,2,3,2;...
    2,3,3,3,2;1,3,3,3,1];
f2=[1,1,1,1,1;1,2,1,1,1;...
    1,1,1,1,1;1,1,1,1,1;...
    1,1,2,1,1;1,2,2,2,1;...
    2,2,2,2,2;2,3,3,3,2;...
    2,3,3,3,2;1,3,3,3,1];
f3=[1,1,1,1,1;1,1,1,1,1;...
    1,1,1,1,1;1,1,1,1,1;...
    1,1,2,2,1;1,2,2,2,2;...
    2,2,3,2,2;2,3,3,3,2;...
    2,3,3,3,2;1,3,3,3,1];
f4=[1,1,1,2,1;1,1,2,2,1;...
    1,1,2,1,1;1,2,1,1,1;...
    2,2,2,1,1;1,2,2,1,1;...
    2,2,2,2,1;2,3,2,2,2;...
    2,3,3,3,2;1,3,3,3,1];
f5=[1,1,1,1,2;1,1,1,1,1;...
    1,1,1,1,1;1,1,1,1,1;...
    1,2,2,1,1;2,2,2,2,1;...
    2,2,2,2,2;2,3,3,3,2;...
    2,3,3,3,2;1,3,3,3,1];
color_index=[57 8 9];
for i=1:3
    f1(f1==i)=color_index(i);
    f2(f2==i)=color_index(i);
    f3(f3==i)=color_index(i);
    f4(f4==i)=color_index(i);
    f5(f5==i)=color_index(i);
end
figure
colormap(colorcube);
imagesc(f1);
caxis([1 64]);
axis image
axis off
hold on
figure
colormap(colorcube);
imagesc(f2);
caxis([1 64]);
axis image
axis off
hold on
figure
colormap(colorcube);
imagesc(f3);
caxis([1 64]);
axis image
axis off
hold on
figure
colormap(colorcube);
imagesc(f4);
caxis([1 64]);
axis image
axis off
hold on
figure
colormap(colorcube);
imagesc(f5);
caxis([1 64]);
axis image
axis off
hold on
c=ones(60,61)*57;
B1=c;
B1(26:35,29:33)=f1;
B2=c;
B2(26:35,29:33)=f2;
B3=c;
B3(26:35,29:33)=f3;
B4=c;
B4(26:35,29:33)=f4;
B5=c;
B5(26:35,29:33)=f5;
figure('color',[0 0 0])
set(gcf,'InvertHardCopy','off');
colormap(colorcube);
imagesc(B1);
caxis([1 64]);
title('1')
set(gca,'DataAspectRatio',[1 1 1])
axis off
grid off
saveas(gcf,'1.jpg');
figure('color',[0 0 0])
set(gcf,'InvertHardCopy','off');
colormap(colorcube);
imagesc(B2);
caxis([1 64]);
title('2')
set(gca,'DataAspectRatio',[1 1 1])
axis off
grid off
saveas(gcf,'2.jpg');
figure('color',[0 0 0])
set(gcf,'InvertHardCopy','off');
colormap(colorcube);
imagesc(B3);
caxis([1 64]);
title('3')
set(gca,'DataAspectRatio',[1 1 1])
axis off
grid off
saveas(gcf,'3.jpg');
figure('color',[0 0 0])
set(gcf,'InvertHardCopy','off');
colormap(colorcube);
imagesc(B4);
caxis([1 64]);
title('4')
set(gca,'DataAspectRatio',[1 1 1])
axis off
grid off
saveas(gcf,'4.jpg');
figure('color',[0 0 0])
set(gcf,'InvertHardCopy','off');
colormap(colorcube);
imagesc(B5);
caxis([1 64]);
title('5')
set(gca,'DataAspectRatio',[1 1 1])
axis off
grid off
saveas(gcf,'5.jpg');

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值