matlab如何设置横纵坐标轴的字体粗细

网上的介绍真是良莠不齐,终于自己摸索出来!!!

1,如果要把图例标注的文字加粗,则在legend1参数里面

%这句参数可修改图例标注的位置,和字体,耶,'Location','SouthEast'
legend1=legend('FontName','Times New Roman',tmpName,'Interpreter', 'none','fontsize',fontSizeLegend,'Location','SouthEast');
title(titleName,'fontsize',fontSize,'FontName','Times New Roman');
xlabel(xLabelName,'fontsize',fontSize,'FontName','Times New Roman');
ylabel(yLabelName,'fontsize',fontSize,'FontName','Times New Roman');
set(gca,'fontweight','bold');%添加这句可以增加横纵坐标轴粗细

2,如果只要把x轴刻度加粗,那就更改xlabel里面的参数'fontweight','bold'

3,如果只要把y轴刻度加粗,那就更改ylabel里面的参数'fontweight','bold'

可能代码不够完整,这个是我数据集benchmark的源代码,也是在这个基础上加粗字体

function plotDrawSave(numTrk,plotDrawStyle,aveSuccessRatePlot,idxSeqSet,rankNum,rankingType,rankIdx,nameTrkAll,thresholdSet,titleName,xLabelName,yLabelName,figName,metricType)

aveSuccessRate11=[];

scrsz = get(0,'ScreenSize');

for idxTrk=1:numTrk
    %each row is the sr plot of one sequence
    tmp=aveSuccessRatePlot(idxTrk, idxSeqSet,:);
    aa=reshape(tmp,[length(idxSeqSet),size(aveSuccessRatePlot,3)]);
    aa=aa(sum(aa,2)>eps,:);
    bb=mean(aa);
    switch rankingType
        case 'AUC'
            perf(idxTrk) = mean(bb);
        case 'threshold'
            perf(idxTrk) = bb(rankIdx);
    end
end

[tmp,indexSort]=sort(perf,'descend');

i=1;
AUC=[];

fontSize = 16;
fontSizeLegend = 10;

figure1 = figure;

axes1 = axes('Parent',figure1,'FontSize',14);
set(gca,'fontweight','bold'); %可以加粗图例的字体
for idxTrk=indexSort(1:rankNum)

    tmp=aveSuccessRatePlot(idxTrk,idxSeqSet,:);
    aa=reshape(tmp,[length(idxSeqSet),size(aveSuccessRatePlot,3)]);
    aa=aa(sum(aa,2)>eps,:);
    bb=mean(aa);
    
    switch rankingType
        case 'AUC'
            score = mean(bb);
            tmp=sprintf('%.3f', score);
        case 'threshold'
            score = bb(rankIdx);
            tmp=sprintf('%.3f', score);
    end    
    
    tmpName{i} = [nameTrkAll{idxTrk} ' [' tmp ']'];
    h(i) = plot(thresholdSet,bb,'color',plotDrawStyle{i}.color, 'lineStyle', plotDrawStyle{i}.lineStyle,'lineWidth', 2,'Parent',axes1);
    set(gca,'fontweight','bold');%添加的增加横纵坐标轴粗细
    hold on
    i=i+1;
end

%可修改图例标注的位置(右下角),和字体,耶,SouthEast
legend1=legend('FontName','Times New Roman',tmpName,'Interpreter', 'none','fontsize',fontSizeLegend,'Location','SouthWest');
%可以加粗图例的字体
title(titleName,'fontsize',fontSize,'FontName','Times New Roman','fontweight','bold');  
xlabel(xLabelName,'fontsize',fontSize,'FontName','Times New Roman');
ylabel(yLabelName,'fontsize',fontSize,'FontName','Times New Roman');

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值