漂亮,美观的图表之Matlab强势回归~~~~走你4

    当图像复杂的时候,通常添加符号,线条的风格,颜色从而区别显示。Figure legenf帮助我们整理,有时候有许多变量需要我们去编码,

这里我们使用legned去满足我们的需求。

部分代码:

% Define a matrix of line spec options
LineStyles = {'-'}; % solid line
MarkerSpecs = {'+','o'}; % plus, circle ... there are more
ColorSpecs = {'r','g','b','k','m'}; % red, green, blue, black ... there are more
cnt = 1;
for i = 1:length(LineStyles)
    for j = 1:length(MarkerSpecs)
        for k = 1:length(ColorSpecs)
            LineSpecs{cnt} = [LineStyles{i} MarkerSpecs{j} ColorSpecs{k}];
            cnt = cnt+1;
        end
    end
end


同时添加新线条表明指定分布,

for i = 1:10
    dataVect(i,:) = (1/sqrt(2*pi*stdVect(i).^2))*exp(-(x-meanVect(i)).^2/(2*stdVect(i).^2)); % Gaussian function
    plot(dataVect(i,:), LineSpecs{i});
    legendMatrix{i} = [sprintf('mean = %.2f, ',meanVect(i)) char(10) sprintf('std = %.2f',stdVect(i))];    
end
legend(legendMatrix,'Location','NorthEastOutside','Fontsize',8);


结果:

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值