把B站表情包植入MATLAB

把B站表情包植入MATLAB

by 今天不飞了

每天做实验画图都是点点线线,枯燥乏味,生无可恋,就突发奇想把各种marker改成表情包。不过只适用于数据量较小的,太多就画的很慢了。


内容

在这里插入图片描述

b站视频链接把B站表情包植入MATLAB


代码

% x,y 坐标向量
% ltype 线型
% mtype 图标编号
% siz 图标大小
function emoplot(x,y,ltype,mtype,siz)
% 加载表情
load emo
x = x(:);
y = y(:);
rp = rp*siz;
cp = cp*siz;
num = length(x);
% 绘制
plot3(x,y,zeros(size(x)),ltype,'LineWidth',5),hold on
for n = 1:num
    h = surf(cp+x(n),rp+y(n),hp,'EdgeAlpha',0);
    if mtype>0 && mtype<35
        img = emo{mtype};
    else
        img = emo{randi(34)};
    end
    set(h,'CData',img,'FaceColor','texturemap');
end
hold off
axis equal
view([0,0,1])
set(gca,'looseInset',[0 0 0 0])
end

注意:其中的emo.mat是把b站表情包下载之后,转换为了matlab格式。可以自己制作也可以找我要


测试

%% 散点
x = randi(20,50,1);
y = randi(20,50,1);
figure
emoplot(x,y,'.',0,1),grid on

%% 线
x = 0:0.2:2*pi;
y = sin(x);
figure
emoplot(x,y,'-',18,0.1),grid on

%% 多线
x = 0:0.2:2*pi;
y1 = sin(x);
y2 = sin(x)*2;
y3 = sin(x)+1;
figure
emoplot(x,y1,'-',1,0.1),hold on
emoplot(x,y2,'-',14,0.1),hold on
emoplot(x,y3,'-',25,0.1),grid on

效果如文章开头所示


其他

  1. 大概率没有bug
  2. emo.mat
    链接:https://pan.baidu.com/s/1jNDFljoyWVp9iVLVw4sctg
    提取码:cjmx
  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 11
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值